Back to Joomla project (class list)

Class TagsHelper - list of methods

Tags helper class, provides methods to perform various tasks relevant tagging of content.

Extends

Package: Joomla\CMS\Helper
Copyright: (C) 2013 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Helper/TagsHelper.php
Project: Joomla

Method Summary

public bool
(mixed $ucmId, \Joomla\CMS\Table\TableInterface $table, mixed $tags = array())

Method to add tag rows to mapping table.
Parameters
  • int $ucmId ID of the #__ucm_content item being tagged
  • \Joomla\CMS\Table\TableInterface $table Table object being tagged
  • array $tags Array of tags to be applied.
Returns
  • bool true on success, otherwise false.
Since
  • 3.1
Show source code of this method: addTagMapping Source Code

public static array
(mixed $tags)

Function that converts tags paths into paths of names
Parameters
  • array $tags Array of tags
Returns
  • array
Since
  • 3.1
Show source code of this method: convertPathsToNames Source Code

public mixed
(mixed $tags)

Create any new tags by looking for #new# in the strings
Parameters
  • array $tags Tags text array from the field
Returns
  • mixed If successful, metadata with new tag titles replaced by tag ids. Otherwise false.
Since
  • 3.1
Show source code of this method: createTagsFromField Source Code

public bool
(\Joomla\CMS\Table\TableInterface $table, mixed $contentItemId)

Method to delete the tag mappings and #__ucm_content record for for an item
Parameters
  • \Joomla\CMS\Table\TableInterface $table Table object of content table where delete occurred
  • int|array $contentItemId ID of the content item. Or an array of key/value pairs with array key being a primary key name and value being the content item ID. Note multiple primary keys are not supported
Returns
  • bool true on success, false on failure
Since
  • 3.1
-
  • \InvalidArgumentException
Show source code of this method: deleteTagData Source Code

public array
(mixed $contentType, mixed $id, mixed $getTagData = true)

Method to get a list of tags for an item, optionally with the tag data.
Parameters
  • string $contentType Content type alias. Dot separated.
  • int $id Id of the item to retrieve tags for.
  • bool $getTagData If true, data from the tags table will be included, defaults to true.
Returns
  • array Array of of tag objects
Since
  • 3.1
Show source code of this method: getItemTags Source Code

public string
(mixed $ids, mixed $prefix)

Method to get a list of tags for a given item.
Parameters
  • mixed $ids The id or array of ids (primary key) of the item to be tagged.
  • string $prefix Dot separated string with the option and view to be used for a url.
Returns
  • string Comma separated list of tag Ids.
Since
  • 3.1
Show source code of this method: getTagIds Source Code

public \Joomla\Database\DatabaseQuery
(mixed $tagId, mixed $typesr = null, mixed $includeChildren = false, mixed $orderByOption = 'c.core_title', mixed $orderDir = 'ASC', mixed $anyOrAll = true, mixed $languageFilter = 'all', mixed $stateFilter = '0,1')

Method to get a query to retrieve a detailed list of items for a tag.
Parameters
  • mixed $tagId Tag or array of tags to be matched
  • mixed $typesr Null, type or array of type aliases for content types to be included in the results
  • bool $includeChildren True to include the results from child tags
  • string $orderByOption Column to order the results by
  • string $orderDir Direction to sort the results in
  • bool $anyOrAll True to include items matching at least one tag, false to include items all tags in the array.
  • string $languageFilter Optional filter on language. Options are 'all', 'current' or any string.
  • string $stateFilter Optional filtering on publication state, defaults to published or unpublished.
Returns
  • \Joomla\Database\DatabaseQuery Query to retrieve a list of tags
Since
  • 3.1
Show source code of this method: getTagItemsQuery Source Code

public array
(mixed $tagIds)

Function that converts tag ids to their tag names
Parameters
  • array $tagIds Array of integer tag ids.
Returns
  • array An array of tag names.
Since
  • 3.1
Show source code of this method: getTagNames Source Code

public mixed
(mixed $id, mixed &$tagTreeArray = array())

Method to get an array of tag ids for the current tag and its children
Parameters
  • int $id An optional ID
  • array & $tagTreeArray Array containing the tag tree
Returns
  • mixed
Since
  • 3.1
Show source code of this method: getTagTreeArray Source Code

public static array
(mixed $arrayType = 'objectList', mixed $selectTypes = null, mixed $useAlias = true)

Method to get a list of types with associated data.
Parameters
  • string $arrayType Optionally specify that the returned list consist of objects, associative arrays, or arrays. Options are: rowList, assocList, and objectList
  • array $selectTypes Optional array of type ids or aliases to limit the results to. Often from a request.
  • bool $useAlias If true, the alias is used to match, if false the type_id is used.
Returns
  • array Array of of types
Since
  • 3.1
Show source code of this method: getTypes Source Code

public bool
(\Joomla\CMS\Table\TableInterface $table, mixed $newTags = array(), mixed $replace = true)

Function that handles saving tags used in a table class after a store()
Parameters
  • \Joomla\CMS\Table\TableInterface $table Table being processed
  • array $newTags Array of new tags
  • bool $replace Flag indicating if all existing tags should be replaced
Returns
  • bool
Since
  • 3.1
Show source code of this method: postStoreProcess Source Code

public null
(\Joomla\CMS\Table\TableInterface $table, mixed $newTags = array())

Function that preProcesses data from a table prior to a store() to ensure proper tag handling
Parameters
  • \Joomla\CMS\Table\TableInterface $table Table being processed
  • array $newTags Array of new tags
Returns
  • null
Since
  • 3.1
Show source code of this method: preStoreProcess Source Code

public static array
(mixed $filters = array())

Function to search tags
Parameters
  • array $filters Filter to apply to the search
Returns
  • array
Since
  • 3.1
Show source code of this method: searchTags Source Code

public void
(mixed $tagId)

Method to delete all instances of a tag from the mapping table. Generally used when a tag is deleted.
Parameters
  • int $tagId The tag_id (primary key) for the deleted tag.
Returns
  • void
Since
  • 3.1
Show source code of this method: tagDeleteInstances Source Code

public bool
(mixed $ucmId, \Joomla\CMS\Table\TableInterface $table, mixed $tags = array(), mixed $replace = true)

Method to add or update tags associated with an item.
Parameters
  • int $ucmId Id of the #__ucm_content item being tagged
  • \Joomla\CMS\Table\TableInterface $table Table object being tagged
  • array $tags Array of tags to be applied.
  • bool $replace Flag indicating if all existing tags should be replaced
Returns
  • bool true on success, otherwise false.
Since
  • 3.1
Show source code of this method: tagItem Source Code

public bool
(mixed $contentId, \Joomla\CMS\Table\TableInterface $table, mixed $tags = array())

Method to untag an item
Parameters
  • int $contentId ID of the content item being untagged
  • \Joomla\CMS\Table\TableInterface $table Table object being untagged
  • array $tags Array of tags to be untagged. Use an empty array to untag all existing tags.
Returns
  • bool true on success, otherwise false.
Since
  • 3.1
Show source code of this method: unTagItem Source Code

Properties Summary

protected bool
$tagsChanged
Helper object for storing and deleting tag information.
Since
  • 3.1
protected bool
$replaceTags
Whether up replace all tags or just add tags
Since
  • 3.1
public string
$typeAlias
Alias for querying mapping and content type table.
Since
  • 3.1

Tags Summary

Since
3.1