original_string: public static function get_tag_areas() {
          global $CFG, $PAGE;
  
          if (empty($CFG->usetags)) {
              throw new moodle_exception('tagsaredisabled', 'tag');
          }
  
          $context = context_system::instance();
          self::validate_context($context);
          $PAGE->set_context($context); // Needed by internal APIs.
          $output = $PAGE->get_renderer('core');
  
          $areas = core_tag_area::get_areas();
          $exportedareas = array();
          foreach ($areas as $itemtype => $component) {
              foreach ($component as $area) {
                  // Move optional fields not part of the DB table to otherdata.
                  $locked = false;
                  if (isset($area->locked)) {
                      $locked = $area->locked;
                      unset($area->locked);
                  }
                  $exporter = new \core_tag\external\tag_area_exporter($area, array('locked' => $locked));
                  $exportedareas[] = $exporter->export($output);
              }
          }
  
          return array(
              'areas' => $exportedareas,
              'warnings' => array(),
          );
      }
code: public static function get_tag_areas() {
          global $CFG, $PAGE;
  
          if (empty($CFG->usetags)) {
              throw new moodle_exception('tagsaredisabled', 'tag');
          }
  
          $context = context_system::instance();
          self::validate_context($context);
          $PAGE->set_context($context); // Needed by internal APIs.
          $output = $PAGE->get_renderer('core');
  
          $areas = core_tag_area::get_areas();
          $exportedareas = array();
          foreach ($areas as $itemtype => $component) {
              foreach ($component as $area) {
                  // Move optional fields not part of the DB table to otherdata.
                  $locked = false;
                  if (isset($area->locked)) {
                      $locked = $area->locked;
                      unset($area->locked);
                  }
                  $exporter = new \core_tag\external\tag_area_exporter($area, array('locked' => $locked));
                  $exportedareas[] = $exporter->export($output);
              }
          }
  
          return array(
              'areas' => $exportedareas,
              'warnings' => array(),
          );
      }
code_tokens: public static function get_tag_areas ( ) { global $ CFG , $ PAGE ; if ( empty ( $ CFG -> usetags ) ) { throw new moodle_exception ( 'tagsaredisabled' , 'tag' ) ; } $ context = context_system :: instance ( ) ; self :: validate_context ( $ context ) ; $ PAGE -> set_context ( $ context ) ; // Needed by internal APIs. $ output = $ PAGE -> get_renderer ( 'core' ) ; $ areas = core_tag_area :: get_areas ( ) ; $ exportedareas = array ( ) ; foreach ( $ areas as $ itemtype => $ component ) { foreach ( $ component as $ area ) { // Move optional fields not part of the DB table to otherdata. $ locked = false ; if ( isset ( $ area -> locked ) ) { $ locked = $ area -> locked ; unset ( $ area -> locked ) ; } $ exporter = new \ core_tag \ external \ tag_area_exporter ( $ area , array ( 'locked' => $ locked ) ) ; $ exportedareas [ ] = $ exporter -> export ( $ output ) ; } } return array ( 'areas' => $ exportedareas , 'warnings' => array ( ) , ) ; }
docstring: Retrieves existing tag areas.
  
  @return array an array of warnings and objects containing the plugin information
  @throws moodle_exception
  @since  Moodle 3.7
docstring_tokens: Retrieves existing tag areas .