Back to ContentType class

Method getTypeId

public mixed
getTypeId
(mixed $typeAlias)
Method to get the id given the type alias
Parameters
  • string $typeAlias Content type alias (for example, 'com_content.article').
Returns
  • mixed type_id for this alias if successful, otherwise null.
Since
  • 3.2
Class: ContentType
Project: Joomla

Method getTypeId - Source code

/**
 * Method to get the id given the type alias
 *
 * @param   string  $typeAlias  Content type alias (for example, 'com_content.article').
 *
 * @return  mixed  type_id for this alias if successful, otherwise null.
 *
 * @since   3.2
 */
public function getTypeId($typeAlias)
{
    $db = $this->_db;
    $query = $db->getQuery(true);
    $query->select($db->quoteName('type_id'))->from($db->quoteName($this->_tbl))->where($db->quoteName('type_alias') . ' = :type_alias')->bind(':type_alias', $typeAlias);
    $db->setQuery($query);
    return $db->loadResult();
}