Back to TagsHelper class

Method getTagNames

public array
getTagNames
(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
Class: TagsHelper
Project: Joomla

Method getTagNames - Source code

/**
 * Function that converts tag ids to their tag names
 *
 * @param   array  $tagIds  Array of integer tag ids.
 *
 * @return  array  An array of tag names.
 *
 * @since   3.1
 */
public function getTagNames($tagIds)
{
    $tagNames = array();
    if (\is_array($tagIds) && \count($tagIds) > 0) {
        $tagIds = ArrayHelper::toInteger($tagIds);
        $db = Factory::getDbo();
        $query = $db->getQuery(true)->select($db->quoteName('title'))->from($db->quoteName('#__tags'))->whereIn($db->quoteName('id'), $tagIds)->order($db->quoteName('title'));
        $db->setQuery($query);
        $tagNames = $db->loadColumn();
    }
    return $tagNames;
}