public static function get_tag_collections() {
        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');

        $collections = core_tag_collection::get_collections();
        $exportedcollections = array();
        foreach ($collections as $collection) {
            $exporter = new \core_tag\external\tag_collection_exporter($collection);
            $exportedcollections[] = $exporter->export($output);
        }

        return array(
            'collections' => $exportedcollections,
            'warnings' => array(),
        );
    }
public static function get_tag_collections() {
        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');

        $collections = core_tag_collection::get_collections();
        $exportedcollections = array();
        foreach ($collections as $collection) {
            $exporter = new \core_tag\external\tag_collection_exporter($collection);
            $exportedcollections[] = $exporter->export($output);
        }

        return array(
            'collections' => $exportedcollections,
            'warnings' => array(),
        );
    }
public static function get_tag_collections ( ) { 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' ) ; $ collections = core_tag_collection :: get_collections ( ) ; $ exportedcollections = array ( ) ; foreach ( $ collections as $ collection ) { $ exporter = new \ core_tag \ external \ tag_collection_exporter ( $ collection ) ; $ exportedcollections [ ] = $ exporter -> export ( $ output ) ; } return array ( 'collections' => $ exportedcollections , 'warnings' => array ( ) , ) ; }
Retrieves existing tag collections.

@return array an array of warnings and tag collections
@throws moodle_exception
@since  Moodle 3.7
Retrieves existing tag collections .