2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Tag area definitions
20 * File db/tag.php lists all available tag areas in core or a plugin.
22 * Each tag area may have the following attributes:
23 * - itemtype (required) - what is tagged. Must be name of the existing DB table
24 * - component - component responsible for tagging, if the tag area is inside a
25 * plugin the component must be the full frankenstyle name of the plugin
26 * - collection - name of the custom tag collection that will be used to store
27 * tags in this area. If specified aministrator will be able to neither add
28 * any other tag areas to this collection nor move this tag area elsewhere
29 * - searchable (only if collection is specified) - wether the tag collection
30 * should be searchable on /tag/search.php
31 * - showstandard - default value for the "Standard tags" attribute of the area,
32 * this is only respected when new tag area is added and ignored during upgrade
33 * - customurl (only if collection is specified) - custom url to use instead of
34 * /tag/search.php to display information about one tag
35 * - callback - name of the function that returns items tagged with this tag,
36 * see core_tag_tag::get_tag_index() and existing callbacks for more details,
37 * callback should return instance of core_tag\output\tagindex
38 * - callbackfile - file where callback is located (if not an autoloaded location)
40 * Language file must contain the human-readable names of the tag areas and
41 * collections (either in plugin language file or in component language file or
42 * lang/en/tag.php in case of core):
43 * - for item type "user":
44 * $string['tagarea_user'] = 'Users';
45 * - for tag collection "mycollection":
46 * $string['tagcollection_mycollection'] = 'My tag collection';
49 * @copyright 2015 Marina Glancy
50 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
53 defined('MOODLE_INTERNAL') ||
die();
57 'itemtype' => 'user', // Users.
58 'component' => 'core',
59 'callback' => 'user_get_tagged_users',
60 'callbackfile' => '/user/lib.php',
61 'showstandard' => core_tag_tag
::HIDE_STANDARD
,
64 'itemtype' => 'course', // Courses.
65 'component' => 'core',
66 'callback' => 'course_get_tagged_courses',
67 'callbackfile' => '/course/lib.php',
70 'itemtype' => 'question', // Questions.
71 'component' => 'core_question',
72 'multiplecontexts' => true,
75 'itemtype' => 'post', // Blog posts.
76 'component' => 'core',
77 'callback' => 'blog_get_tagged_posts',
78 'callbackfile' => '/blog/lib.php',
81 'itemtype' => 'blog_external', // External blogs.
82 'component' => 'core',
85 'itemtype' => 'course_modules', // Course modules.
86 'component' => 'core',
87 'callback' => 'course_get_tagged_course_modules',
88 'callbackfile' => '/course/lib.php',