public static function get_tag_cloud($tagcollid = 0, $isstandard = false, $limit = 150, $sort = 'name',
            $search = '', $fromctx = 0, $ctx = 0, $rec = 1) {
        global $CFG, $PAGE;

        $params = self::validate_parameters(self::get_tag_cloud_parameters(),
            array(
                'tagcollid' => $tagcollid,
                'isstandard' => $isstandard,
                'limit' => $limit,
                'sort' => $sort,
                'search' => $search,
                'fromctx' => $fromctx,
                'ctx' => $ctx,
                'rec' => $rec,
            )
        );

        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');

        $tagcloud = core_tag_collection::get_tag_cloud($params['tagcollid'], $params['isstandard'], $params['limit'],
            $params['sort'], $params['search'], $params['fromctx'], $params['ctx'], $params['rec']);

        $result = $tagcloud->export_for_template($output);
        $result->warnings = array();

        return (array) $result;
    }
public static function get_tag_cloud($tagcollid = 0, $isstandard = false, $limit = 150, $sort = 'name',
            $search = '', $fromctx = 0, $ctx = 0, $rec = 1) {
        global $CFG, $PAGE;

        $params = self::validate_parameters(self::get_tag_cloud_parameters(),
            array(
                'tagcollid' => $tagcollid,
                'isstandard' => $isstandard,
                'limit' => $limit,
                'sort' => $sort,
                'search' => $search,
                'fromctx' => $fromctx,
                'ctx' => $ctx,
                'rec' => $rec,
            )
        );

        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');

        $tagcloud = core_tag_collection::get_tag_cloud($params['tagcollid'], $params['isstandard'], $params['limit'],
            $params['sort'], $params['search'], $params['fromctx'], $params['ctx'], $params['rec']);

        $result = $tagcloud->export_for_template($output);
        $result->warnings = array();

        return (array) $result;
    }
public static function get_tag_cloud ( $ tagcollid = 0 , $ isstandard = false , $ limit = 150 , $ sort = 'name' , $ search = '' , $ fromctx = 0 , $ ctx = 0 , $ rec = 1 ) { global $ CFG , $ PAGE ; $ params = self :: validate_parameters ( self :: get_tag_cloud_parameters ( ) , array ( 'tagcollid' => $ tagcollid , 'isstandard' => $ isstandard , 'limit' => $ limit , 'sort' => $ sort , 'search' => $ search , 'fromctx' => $ fromctx , 'ctx' => $ ctx , 'rec' => $ rec , ) ) ; 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' ) ; $ tagcloud = core_tag_collection :: get_tag_cloud ( $ params [ 'tagcollid' ] , $ params [ 'isstandard' ] , $ params [ 'limit' ] , $ params [ 'sort' ] , $ params [ 'search' ] , $ params [ 'fromctx' ] , $ params [ 'ctx' ] , $ params [ 'rec' ] ) ; $ result = $ tagcloud -> export_for_template ( $ output ) ; $ result -> warnings = array ( ) ; return ( array ) $ result ; }
Retrieves a tag cloud for display.

@param int $tagcollid tag collection id
@param bool $isstandard return only standard tags
@param int $limit maximum number of tags to retrieve, tags are sorted by the instance count
descending here regardless of $sort parameter
@param string $sort sort order for display, default 'name' - tags will be sorted after they are retrieved
@param string $search search string
@param int $fromctx context id where this tag cloud is displayed
@param int $ctx only retrieve tag instances in this context
@param int $rec retrieve tag instances in the $ctx context and it's children (default 1)
@return array an array of warnings and tag cloud information and items
@throws moodle_exception
@since  Moodle 3.7
Retrieves a tag cloud for display .