Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Static Public Member Functions | Static Protected Member Functions | List of all members
core_tag_area Class Reference

Class to manage tag areas. More...

Static Public Member Functions

static allows_tagging_in_multiple_contexts ($component, $itemtype)
 Checks if the tag area allows items to be tagged in multiple different contexts. More...
 
static display_name ($component, $itemtype)
 Returns the display name for this area. More...
 
static get_areas ($tagcollid=null, $enabledonly=false)
 Returns the list of areas indexed by itemtype and component. More...
 
static get_by_id ($tagareaid)
 Retrieves info about one tag area. More...
 
static get_collection ($component, $itemtype)
 Returns the id of the tag collection that should be used for storing tags of this itemtype. More...
 
static get_showstandard ($component, $itemtype)
 Returns wether this tag area should display or not standard tags when user edits it. More...
 
static is_enabled ($component, $itemtype)
 Returns whether the tag area is enabled. More...
 
static move_tags ($component, $itemtype, $tagcollid)
 Moves existing tags associated with an item type to another tag collection. More...
 
static reset_definitions_for_component ($componentname)
 Update the database to contain a list of tagged areas for a component. More...
 
static uninstall ($pluginname)
 Deletes all tag areas, collections and instances associated with the plugin. More...
 
static update ($existing, $data)
 Update the tag area. More...
 

Static Protected Member Functions

static create ($record)
 Create a new tag area. More...
 
static delete ($record)
 Completely delete a tag area and all instances inside it. More...
 
static get_definitions_for_component ($componentname)
 Returns all tag areas and collections that are currently cached in DB for this component. More...
 

Detailed Description

Class to manage tag areas.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ allows_tagging_in_multiple_contexts()

static core_tag_area::allows_tagging_in_multiple_contexts (   $component,
  $itemtype 
)
static

Checks if the tag area allows items to be tagged in multiple different contexts.

If true then it indicates that not all tag instance contexts must match the context of the item they are tagging. If false then all tag instance should match the context of the item they are tagging.

Example use case for multi-context tagging: A question that exists in a course category context may be used by multiple child courses. The question tag area can allow tag instances to be created in multiple contexts which allows the tag API to tag the question at the course category context and then seperately in each of the child course contexts.

Parameters
string$componentcomponent responsible for tagging
string$itemtypewhat is being tagged, for example, 'post', 'course', 'user', etc.
Return values
bool

◆ create()

static core_tag_area::create (   $record)
staticprotected

Create a new tag area.

Parameters
stdClass$record

◆ delete()

static core_tag_area::delete (   $record)
staticprotected

Completely delete a tag area and all instances inside it.

Parameters
stdClass$record

◆ display_name()

static core_tag_area::display_name (   $component,
  $itemtype 
)
static

Returns the display name for this area.

Parameters
string$component
string$itemtype
Return values
lang_string

◆ get_areas()

static core_tag_area::get_areas (   $tagcollid = null,
  $enabledonly = false 
)
static

Returns the list of areas indexed by itemtype and component.

Parameters
int$tagcollidreturn only areas in this tag collection
bool$enabledonlyreturn only enabled tag areas
Return values
arrayitemtype=>component=>tagarea object

◆ get_by_id()

static core_tag_area::get_by_id (   $tagareaid)
static

Retrieves info about one tag area.

Parameters
int$tagareaid
Return values
stdClass

◆ get_collection()

static core_tag_area::get_collection (   $component,
  $itemtype 
)
static

Returns the id of the tag collection that should be used for storing tags of this itemtype.

Parameters
string$componentcomponent responsible for tagging
string$itemtypewhat is being tagged, for example, 'post', 'course', 'user', etc.
Return values
int

◆ get_definitions_for_component()

static core_tag_area::get_definitions_for_component (   $componentname)
staticprotected

Returns all tag areas and collections that are currently cached in DB for this component.

Parameters
string$componentname
Return values
arrayfirst element is the list of areas and the second list of collections

◆ get_showstandard()

static core_tag_area::get_showstandard (   $component,
  $itemtype 
)
static

Returns wether this tag area should display or not standard tags when user edits it.

Parameters
string$componentcomponent responsible for tagging
string$itemtypewhat is being tagged, for example, 'post', 'course', 'user', etc.
Return values
int

◆ is_enabled()

static core_tag_area::is_enabled (   $component,
  $itemtype 
)
static

Returns whether the tag area is enabled.

Parameters
string$componentcomponent responsible for tagging
string$itemtypewhat is being tagged, for example, 'post', 'course', 'user', etc.
Return values
bool|null

◆ move_tags()

static core_tag_area::move_tags (   $component,
  $itemtype,
  $tagcollid 
)
static

Moves existing tags associated with an item type to another tag collection.

Parameters
string$component
string$itemtype
int$tagcollid

◆ reset_definitions_for_component()

static core_tag_area::reset_definitions_for_component (   $componentname)
static

Update the database to contain a list of tagged areas for a component.

The list of tagged areas is read from [plugindir]/db/tag.php

Parameters
string$componentname- The frankenstyle component name.

◆ uninstall()

static core_tag_area::uninstall (   $pluginname)
static

Deletes all tag areas, collections and instances associated with the plugin.

Parameters
string$pluginname

◆ update()

static core_tag_area::update (   $existing,
  $data 
)
static

Update the tag area.

Parameters
stdClass$existingcurrent record from DB table tag_area
array | stdClass$datafields that need updating

The documentation for this class was generated from the following file: