function properties_sql_properties_template_load_paging in Dynamic properties 7
Load a paged amount of templates.
Parameters
$per_page: Number of templates per page.
File
- properties_sql/
properties_sql.module, line 308 - This module implements the attribute and category API with a SQL backend.
Code
function properties_sql_properties_template_load_paging($per_page, array $options = array()) {
$query = db_select('properties_template', 'pt')
->extend('PagerDefault')
->fields('pt')
->limit($per_page);
if (isset($options['header'])) {
$query = $query
->extend('TableSort')
->orderByHeader($options['header']);
}
if (!empty($options['search'])) {
$query
->condition(db_or()
->condition('name', $options['search'] . '%', 'LIKE')
->condition('label', $options['search'] . '%', 'LIKE'));
}
return $query
->execute()
->fetchAllAssoc('name');
}