NAME
MT::Tag - Movable Type tag record and methods
SYNOPSIS
use MT::Tag; my $tag = MT::Tag->new; $tag->name('favorite'); $tag->save or die $tag->errstr;
DATA ACCESS METHODS
The MT::Tag object holds the following pieces of data. These fields can be accessed and set using the standard data access methods described in the MT::Object documentation.
- id
The numeric ID of the tag.
- name
The name of the tag.
- n8d_id
The ID of a "normalized" version of this tag. If undef or 0, it would signifiy this tag is a normalized tag name.
DATA LOOKUP
In addition to numeric ID lookup, you can look up or sort records by any combination of the following fields. See the load documentation in MT::Object for more information.
- name
OTHER METHODS
cache
Return the entry tags. If there are no cached tags, they are loaded first. If the tags have already been loaded with this method, that data is returned instead.
cache_obj
Cache the session tags.
clear_cache
Remove the tag cache.
join($seperator, @tags)
Return the given tags as a string with the defined seperator.
split($seperator, $tags)
Split-up the given tags string by the given seperator.
normalize($tag)
Sanitize the text (remove potentially characters) and lower-case the tag. The tag may be given as a string or as a tag object. In the case of the latter, $tag->name
attribute is used.
load_by_datasource($datasource, $terms, $args)
Return a list of tags given by an object datasource type, selection terms and arguments.
$tag->save()
Save the literal as well as a normalized copy if one does not exist.
$tag->remove()
Remove the tag and all its children unless it is referenced by another entry.
NOTES
- When you remove a tag using MT::Tag::remove, in addition to removing the tag record, all of the related MT::ObjectTag records are removed as well.
AUTHOR & COPYRIGHT
Please see "AUTHOR & COPYRIGHT" in MT.