diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index e0570e428d2..10124c0c3b3 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -4511,10 +4511,12 @@ EOD; * @param int $limit limit the number of tags to display, if size of $tags is more than this limit the "more" link * will be appended to the end, JS will toggle the rest of the tags * @param context $pagecontext specify if needed to overwrite the current page context for the view tag link + * @param bool $accesshidelabel if true, the label should have class="accesshide" added. * @return string */ - public function tag_list($tags, $label = null, $classes = '', $limit = 10, $pagecontext = null) { - $list = new \core_tag\output\taglist($tags, $label, $classes, $limit, $pagecontext); + public function tag_list($tags, $label = null, $classes = '', $limit = 10, + $pagecontext = null, $accesshidelabel = false) { + $list = new \core_tag\output\taglist($tags, $label, $classes, $limit, $pagecontext, $accesshidelabel); return $this->render_from_template('core_tag/taglist', $list->export_for_template($this)); } diff --git a/tag/classes/output/taglist.php b/tag/classes/output/taglist.php index df821f45664..dda618d7d19 100644 --- a/tag/classes/output/taglist.php +++ b/tag/classes/output/taglist.php @@ -45,6 +45,9 @@ class taglist implements templatable { /** @var string */ protected $label; + /** @var bool $accesshidelabel if true, the label should have class="accesshide" added. */ + protected $accesshidelabel; + /** @var string */ protected $classes; @@ -59,14 +62,17 @@ class taglist implements templatable { * to use default, set to '' (empty string) to omit the label completely * @param string $classes additional classes for the enclosing div element * @param int $limit limit the number of tags to display, if size of $tags is more than this limit the "more" link - * will be appended to the end, JS will toggle the rest of the tags + * will be appended to the end, JS will toggle the rest of the tags. 0 means no limit. * @param context $pagecontext specify if needed to overwrite the current page context for the view tag link + * @param bool $accesshidelabel if true, the label should have class="accesshide" added. */ - public function __construct($tags, $label = null, $classes = '', $limit = 10, $pagecontext = null) { + public function __construct($tags, $label = null, $classes = '', + $limit = 10, $pagecontext = null, $accesshidelabel = false) { global $PAGE; $canmanagetags = has_capability('moodle/tag:manage', \context_system::instance()); $this->label = ($label === null) ? get_string('tags') : $label; + $this->accesshidelabel = $accesshidelabel; $this->classes = $classes; $fromctx = $pagecontext ? $pagecontext->id : (($PAGE->context->contextlevel == CONTEXT_SYSTEM) ? 0 : $PAGE->context->id); @@ -106,6 +112,7 @@ class taglist implements templatable { return (object)array( 'tags' => array_values($this->tags), 'label' => $this->label, + 'accesshidelabel' => $this->accesshidelabel, 'tagscount' => $cnt, 'overflow' => ($this->limit && $cnt > $this->limit) ? 1 : 0, 'classes' => $this->classes, diff --git a/tag/classes/tag.php b/tag/classes/tag.php index 5047197da86..ba04be8dc5f 100644 --- a/tag/classes/tag.php +++ b/tag/classes/tag.php @@ -648,7 +648,8 @@ class core_tag_tag { * @param int[] $itemids * @param int $standardonly wether to return only standard tags or any * @param int $tiuserid tag instance user id, only needed for tag areas with user tagging - * @return core_tag_tag[] each object contains additional fields taginstanceid, taginstancecontextid and ordering + * @return core_tag_tag[][] first array key is itemid. For each itemid, + * an array tagid => tag object with additional fields taginstanceid, taginstancecontextid and ordering */ public static function get_items_tags($component, $itemtype, $itemids, $standardonly = self::BOTH_STANDARD_AND_NOT, $tiuserid = 0) { diff --git a/tag/templates/taglist.mustache b/tag/templates/taglist.mustache index 72975fd8068..7dc30a386c3 100644 --- a/tag/templates/taglist.mustache +++ b/tag/templates/taglist.mustache @@ -38,6 +38,7 @@ {"id":1,"name":"Mice","viewurl":"http://moodle.org/tag/index.php?tag=Mice","isstandard":"0","flag":0} ], "label": "Tags", + "accesshidelabel": false, "tagscount": 3, "overflow": 1, "classes": "someadditionalclass" @@ -47,7 +48,7 @@ {{#tagscount}}