[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Helper/ -> TagsHelper.php (summary)

Joomla! Content Management System

Copyright: (C) 2013 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 1086 lines (40 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

TagsHelper:: (17 methods):
  addTagMapping()
  convertPathsToNames()
  createTagsFromField()
  deleteTagData()
  getItemTags()
  getMultipleItemTags()
  getTagIds()
  getTagItemsQuery()
  getTagNames()
  getTagTreeArray()
  getTypes()
  postStoreProcess()
  preStoreProcess()
  searchTags()
  tagDeleteInstances()
  tagItem()
  unTagItem()


Class: TagsHelper  - X-Ref

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

addTagMapping($ucmId, TableInterface $table, $tags = array()   X-Ref
Method to add tag rows to mapping table.

param: integer         $ucmId  ID of the #__ucm_content item being tagged
param: TableInterface  $table  Table object being tagged
param: array           $tags   Array of tags to be applied.
return: boolean  true on success, otherwise false.

convertPathsToNames($tags)   X-Ref
Function that converts tags paths into paths of names

param: array  $tags  Array of tags
return: array

createTagsFromField($tags)   X-Ref
Create any new tags by looking for #new# in the strings

param: array  $tags  Tags text array from the field
return: mixed   If successful, metadata with new tag titles replaced by tag ids. Otherwise false.

deleteTagData(TableInterface $table, $contentItemId)   X-Ref
Method to delete the tag mappings and #__ucm_content record for for an item

param: TableInterface  $table          Table object of content table where delete occurred
param: integer|array   $contentItemId  ID of the content item. Or an array of key/value pairs with array key
return: boolean  true on success, false on failure

getItemTags($contentType, $id, $getTagData = true)   X-Ref
Method to get a list of tags for an item, optionally with the tag data.

param: string   $contentType  Content type alias. Dot separated.
param: integer  $id           Id of the item to retrieve tags for.
param: boolean  $getTagData   If true, data from the tags table will be included, defaults to true.
return: array    Array of of tag objects

getMultipleItemTags($contentType, array $ids, $getTagData = true)   X-Ref
Method to get a list of tags for multiple items, optionally with the tag data.

param: string   $contentType  Content type alias. Dot separated.
param: array    $ids          Id of the item to retrieve tags for.
param: boolean  $getTagData   If true, data from the tags table will be included, defaults to true.
return: array    Array of of tag objects grouped by Id.

getTagIds($ids, $prefix)   X-Ref
Method to get a list of tags for a given item.
Normally used for displaying a list of tags within a layout

param: mixed   $ids     The id or array of ids (primary key) of the item to be tagged.
param: string  $prefix  Dot separated string with the option and view to be used for a url.
return: string   Comma separated list of tag Ids.

getTagItemsQuery($tagId,$typesr = null,$includeChildren = false,$orderByOption = 'c.core_title',$orderDir = 'ASC',$anyOrAll = true,$languageFilter = 'all',$stateFilter = '0,1')   X-Ref
Method to get a query to retrieve a detailed list of items for a tag.

param: mixed    $tagId            Tag or array of tags to be matched
param: mixed    $typesr           Null, type or array of type aliases for content types to be included in the results
param: boolean  $includeChildren  True to include the results from child tags
param: string   $orderByOption    Column to order the results by
param: string   $orderDir         Direction to sort the results in
param: boolean  $anyOrAll         True to include items matching at least one tag, false to include
param: string   $languageFilter   Optional filter on language. Options are 'all', 'current' or any string.
param: string   $stateFilter      Optional filtering on publication state, defaults to published or unpublished.
return: \Joomla\Database\DatabaseQuery  Query to retrieve a list of tags

getTagNames($tagIds)   X-Ref
Function that converts tag ids to their tag names

param: array  $tagIds  Array of integer tag ids.
return: array  An array of tag names.

getTagTreeArray($id, &$tagTreeArray = array()   X-Ref
Method to get an array of tag ids for the current tag and its children

param: integer  $id             An optional ID
param: array    &$tagTreeArray  Array containing the tag tree
return: mixed

getTypes($arrayType = 'objectList', $selectTypes = null, $useAlias = true)   X-Ref
Method to get a list of types with associated data.

param: string   $arrayType    Optionally specify that the returned list consist of objects, associative arrays, or arrays.
param: array    $selectTypes  Optional array of type ids or aliases to limit the results to. Often from a request.
param: boolean  $useAlias     If true, the alias is used to match, if false the type_id is used.
return: array   Array of of types

postStoreProcess(TableInterface $table, $newTags = array()   X-Ref
Function that handles saving tags used in a table class after a store()

param: TableInterface  $table    Table being processed
param: array           $newTags  Array of new tags
param: boolean         $replace  Flag indicating if all existing tags should be replaced
return: boolean

preStoreProcess(TableInterface $table, $newTags = array()   X-Ref
Function that preProcesses data from a table prior to a store() to ensure proper tag handling

param: TableInterface  $table    Table being processed
param: array           $newTags  Array of new tags
return: null

searchTags($filters = array()   X-Ref
Function to search tags

param: array  $filters  Filter to apply to the search
return: array

tagDeleteInstances($tagId)   X-Ref
Method to delete all instances of a tag from the mapping table. Generally used when a tag is deleted.

param: integer  $tagId  The tag_id (primary key) for the deleted tag.
return: void

tagItem($ucmId, TableInterface $table, $tags = array()   X-Ref
Method to add or update tags associated with an item.

param: integer         $ucmId    Id of the #__ucm_content item being tagged
param: TableInterface  $table    Table object being tagged
param: array           $tags     Array of tags to be applied.
param: boolean         $replace  Flag indicating if all existing tags should be replaced
return: boolean  true on success, otherwise false.

unTagItem($contentId, TableInterface $table, $tags = array()   X-Ref
Method to untag an item

param: integer         $contentId  ID of the content item being untagged
param: TableInterface  $table      Table object being untagged
param: array           $tags       Array of tags to be untagged. Use an empty array to untag all existing tags.
return: boolean  true on success, otherwise false.



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer