Back to UCMType class

Method getTypeId

public mixed
getTypeId
(mixed $alias = null)
Retrieves the UCM type ID
Parameters
  • string $alias The string of the type alias
Returns
  • mixed The ID of the requested type or false if type is not found
Since
  • 3.1
Class: UCMType
Project: Joomla

Method getTypeId - Source code

/**
 * Retrieves the UCM type ID
 *
 * @param   string  $alias  The string of the type alias
 *
 * @return  mixed  The ID of the requested type or false if type is not found
 *
 * @since   3.1
 */
public function getTypeId($alias = null)
{
    if (!$alias) {
        $alias = $this->alias;
    }
    $query = $this->db->getQuery(true)->select($this->db->quoteName('ct.type_id'))->from($this->db->quoteName('#__content_types', 'ct'))->where($this->db->quoteName('ct.type_alias') . ' = :alias')->bind(':alias', $alias);
    $this->db->setQuery($query);
    $id = $this->db->loadResult();
    if (!$id) {
        return false;
    }
    return $id;
}