Back to ChromestyleField class

Method getTemplates

protected array
getTemplates
()
Return a list of templates
Returns
  • array List of templates
Since
  • 3.2.1

Method getTemplates - Source code

/**
 * Return a list of templates
 *
 * @return  array  List of templates
 *
 * @since   3.2.1
 */
protected function getTemplates()
{
    $db = Factory::getDbo();
    // Get the database object and a new query object.
    $query = $db->getQuery(true);
    // Build the query.
    $query->select([$db->quoteName('element'), $db->quoteName('name')])->from($db->quoteName('#__extensions'))->where([$db->quoteName('client_id') . ' = :clientId', $db->quoteName('type') . ' = ' . $db->quote('template'), $db->quoteName('enabled') . ' = 1'])->bind(':clientId', $this->clientId, ParameterType::INTEGER);
    // Set the query and load the templates.
    $db->setQuery($query);
    return $db->loadObjectList('element');
}