Mixin_Tag

Package: Record\Mixin

class Mixin_Tag

extends Omeka_Record_Mixin_AbstractMixin

Mixin_Tag::__construct(Omeka_Record_AbstractRecord $record)
Parameters:
Mixin_Tag::beforeDelete()

Fires whenever deleting a record that is taggable This will actually delete all the references to a specific tag for a specific record

Mixin_Tag::afterSave($args)
Parameters:
  • $args

Mixin_Tag::deleteTaggings()
Mixin_Tag::getTaggings()

Retrieve all the Taggings objects that represent between a specific tag and the current record Called by whatever record has enabled this module

Returns:

array of Taggings

Mixin_Tag::getTags($order = array())

Get all the Tag records associated with this record

Parameters:
  • $order

Returns:

array of Tag

Mixin_Tag::deleteTags($tags, $delimiter = null)

Delete a tag from the record

Parameters:
  • $tags (string|array) – The tag name or array of tag names to delete from the record

  • $delimiter (string) – The delimiter of the tags. Not applicable if $tags is an array

Returns:

bool Returns whether a tag in $tags was deleted. Returns false if $tags is empty. Returns true if at least one tag in $tags is deleted.

Mixin_Tag::hasTag($tag)

If the $tag were a string and the keys of Tags were just the names of the tags, this would be: in_array(array_keys($this->Tags))

Parameters:
  • $tag

Returns:

bool

Mixin_Tag::_getTagsFromString($string, $delimiter = null)

Converts a delimited string of tags into an array of tag strings

Parameters:
  • $string (string) – A delimited string of tags

  • $delimiter

Returns:

array An array of tag strings

Mixin_Tag::addTags($tags, $delimiter = null)

Set tags to be saved to the record.

Parameters:
  • $tags (array|string) – Either an array of tags or a delimited string

  • $delimiter

Mixin_Tag::applyTags($inputTags)

Apply tags

Parameters:
  • $inputTags (array) –

Mixin_Tag::diffTags($inputTags, $tags = null)

Calculate the difference between a tag string and a set of tags

Parameters:
  • $inputTags

  • $tags

Returns:

array Keys(‘removed’,’added’)

Mixin_Tag::applyTagString($string, $delimiter = null)

This will add tags that are in the tag string and remove those that are no longer in the tag string

Parameters:
  • $string (string) – A string of tags delimited by $delimiter

  • $delimiter (string|null) –