class PETUIController in Previewable email templates 7
PET UI controller.
Hierarchy
- class \EntityDefaultUIController
- class \PETUIController
Expanded class hierarchy of PETUIController
1 string reference to 'PETUIController'
- pet_entity_info in ./
pet.module - Implements hook_entity_info().
File
- ./
pet.module, line 129 - Previewable Email Template module.
View source
class PETUIController extends EntityDefaultUIController {
/**
* Overrides hook_menu() defaults.
*/
public function hook_menu() {
$items = parent::hook_menu();
$items[$this->path]['description'] = 'Create previewable email templates with token and rules support.';
return $items;
}
/**
* Defaults a larger pagerLimit for ease of administration.
*
* @see EntityDefaultUIController::__construct()
*/
public function __construct($entity_type, $entity_info) {
$this->overviewPagerLimit = 100;
return parent::__construct($entity_type, $entity_info);
}
/**
* Copy of EntityDefaultUIController::overviewTable() sorts.
*
* @see EntityDefaultUIController::overviewTable();
*/
public function overviewTable($conditions = array()) {
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', $this->entityType);
// PET: Adding table sorts.
$tableSort = array(
'name' => array(
'data' => 'Label',
'type' => 'property',
'specifier' => 'name',
),
'status' => array(
'data' => 'Status',
'type' => 'property',
'specifier' => 'status',
),
);
$query
->tableSort($tableSort);
// Add all conditions to query.
foreach ($conditions as $key => $value) {
$query
->propertyCondition($key, $value);
}
if ($this->overviewPagerLimit) {
$query
->pager($this->overviewPagerLimit);
}
$results = $query
->execute();
$ids = isset($results[$this->entityType]) ? array_keys($results[$this->entityType]) : array();
$entities = $ids ? entity_load($this->entityType, $ids) : array();
// PET: This removes harcoded sort (only change in this func)
//ksort($entities);
$rows = array();
foreach ($entities as $entity) {
$rows[] = $this
->overviewTableRow($conditions, entity_id($this->entityType, $entity), $entity);
}
$render = array(
'#theme' => 'table',
'#header' => $this
->overviewTableHeaders($conditions, $rows),
'#rows' => $rows,
'#empty' => t('None.'),
);
return $render;
}
/**
* Generates the table headers for the overview table.
*
* Pretty much a clone of EntityDefaultUIController but adds sorts.
*
* @see EntityDefaultUIController::overviewTableHeaders()
*/
protected function overviewTableHeaders($conditions, $rows = array(), $additional_header = array()) {
$header = $additional_header;
// Add a different sort.
array_unshift($header, array(
'data' => t('Label'),
'field' => 'name',
'sort' => 'asc',
));
if (!empty($this->entityInfo['exportable'])) {
$header[] = array(
'data' => t('Status'),
'field' => 'status',
'sort' => 'desc',
);
}
// Add operations with the right colspan.
$header[] = array(
'data' => t('Operations'),
'colspan' => $this
->operationCount(),
);
return $header;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityDefaultUIController:: |
protected | property | ||
EntityDefaultUIController:: |
protected | property | ||
EntityDefaultUIController:: |
protected | property | ||
EntityDefaultUIController:: |
public | property | Defines the number of entries to show per page in overview table. | |
EntityDefaultUIController:: |
public | function | Applies an operation to the given entity. | |
EntityDefaultUIController:: |
public | function | Entity submit builder invoked via entity_ui_form_submit_build_entity(). | |
EntityDefaultUIController:: |
public | function | Provides definitions for implementing hook_forms(). | |
EntityDefaultUIController:: |
protected | function | Returns the operation count for calculating colspans. | |
EntityDefaultUIController:: |
public | function | Builds the operation form. | |
EntityDefaultUIController:: |
public | function | Operation form submit callback. | 1 |
EntityDefaultUIController:: |
public | function | Operation form validation callback. | |
EntityDefaultUIController:: |
public | function | Builds the entity overview form. | |
EntityDefaultUIController:: |
public | function | Overview form submit callback. | |
EntityDefaultUIController:: |
public | function | Overview form validation callback. | |
EntityDefaultUIController:: |
protected | function | Generates the row for the passed entity and may be overridden in order to customize the rows. | |
PETUIController:: |
public | function |
Overrides hook_menu() defaults. Overrides EntityDefaultUIController:: |
|
PETUIController:: |
public | function |
Copy of EntityDefaultUIController::overviewTable() sorts. Overrides EntityDefaultUIController:: |
|
PETUIController:: |
protected | function |
Generates the table headers for the overview table. Overrides EntityDefaultUIController:: |
|
PETUIController:: |
public | function |
Defaults a larger pagerLimit for ease of administration. Overrides EntityDefaultUIController:: |