Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
/lib/db/ -> tag.php (source)

Differences Between: [Versions 311 and 403]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   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.
   8  //
   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.
  13  //
  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/>.
  16  
  17  /**
  18   * Tag area definitions
  19   *
  20   * File db/tag.php lists all available tag areas in core or a plugin.
  21   *
  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)
  39   *
  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';
  47   *
  48   * @package   core
  49   * @copyright 2015 Marina Glancy
  50   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  51   */
  52  
  53  defined('MOODLE_INTERNAL') || die();
  54  
  55  $tagareas = array(
  56      array(
  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,
  62      ),
  63      array(
  64          'itemtype' => 'course', // Courses.
  65          'component' => 'core',
  66          'callback' => 'course_get_tagged_courses',
  67          'callbackfile' => '/course/lib.php',
  68      ),
  69      array(
  70          'itemtype' => 'question', // Questions.
  71          'component' => 'core_question',
  72          'multiplecontexts' => true,
  73      ),
  74      array(
  75          'itemtype' => 'post', // Blog posts.
  76          'component' => 'core',
  77          'callback' => 'blog_get_tagged_posts',
  78          'callbackfile' => '/blog/lib.php',
  79      ),
  80      array(
  81          'itemtype' => 'blog_external', // External blogs.
  82          'component' => 'core',
  83      ),
  84      array(
  85          'itemtype' => 'course_modules', // Course modules.
  86          'component' => 'core',
  87          'callback' => 'course_get_tagged_course_modules',
  88          'callbackfile' => '/course/lib.php',
  89      ),
  90  );