original_string: public static function tree_extra_branches($contextid, $element) {
  
          $params = external_api::validate_parameters(self::tree_extra_branches_parameters(), [
              'contextid' => $contextid,
              'element' => $element,
          ]);
  
          $context = context_helper::instance_by_id($params['contextid']);
  
          self::validate_context($context);
          api::check_can_manage_data_registry($context->id);
  
          switch ($params['element']) {
              case 'course':
                  $branches = data_registry_page::get_courses_branch($context);
                  break;
              case 'module':
                  $branches = data_registry_page::get_modules_branch($context);
                  break;
              case 'block':
                  $branches = data_registry_page::get_blocks_branch($context);
                  break;
              default:
                  throw new \moodle_exception('Unsupported element provided.');
          }
  
          return [
              'branches' => $branches,
              'warnings' => [],
          ];
      }
code: public static function tree_extra_branches($contextid, $element) {
  
          $params = external_api::validate_parameters(self::tree_extra_branches_parameters(), [
              'contextid' => $contextid,
              'element' => $element,
          ]);
  
          $context = context_helper::instance_by_id($params['contextid']);
  
          self::validate_context($context);
          api::check_can_manage_data_registry($context->id);
  
          switch ($params['element']) {
              case 'course':
                  $branches = data_registry_page::get_courses_branch($context);
                  break;
              case 'module':
                  $branches = data_registry_page::get_modules_branch($context);
                  break;
              case 'block':
                  $branches = data_registry_page::get_blocks_branch($context);
                  break;
              default:
                  throw new \moodle_exception('Unsupported element provided.');
          }
  
          return [
              'branches' => $branches,
              'warnings' => [],
          ];
      }
code_tokens: public static function tree_extra_branches ( $ contextid , $ element ) { $ params = external_api :: validate_parameters ( self :: tree_extra_branches_parameters ( ) , [ 'contextid' => $ contextid , 'element' => $ element , ] ) ; $ context = context_helper :: instance_by_id ( $ params [ 'contextid' ] ) ; self :: validate_context ( $ context ) ; api :: check_can_manage_data_registry ( $ context -> id ) ; switch ( $ params [ 'element' ] ) { case 'course' : $ branches = data_registry_page :: get_courses_branch ( $ context ) ; break ; case 'module' : $ branches = data_registry_page :: get_modules_branch ( $ context ) ; break ; case 'block' : $ branches = data_registry_page :: get_blocks_branch ( $ context ) ; break ; default : throw new \ moodle_exception ( 'Unsupported element provided.' ) ; } return [ 'branches' => $ branches , 'warnings' => [ ] , ] ; }
docstring: Returns tree extra branches.
  
  @since Moodle 3.5
  @param int $contextid
  @param string $element
  @return array
docstring_tokens: Returns tree extra branches .