class RulesLinkUIController in Rules Link 7
Same name and namespace in other branches
- 7.2 rules_link.admin.inc \RulesLinkUIController
UI controller.
Hierarchy
- class \EntityDefaultUIController
- class \RulesLinkUIController
Expanded class hierarchy of RulesLinkUIController
1 string reference to 'RulesLinkUIController'
- rules_link_entity_info in ./
rules_link.module - Implements hook_entity_info().
File
- ./
rules_link.admin.inc, line 11 - Generate a admin UI.
View source
class RulesLinkUIController extends EntityDefaultUIController {
/**
* Overrides EntityDefaultUIController::hook_menu() defaults.
*/
public function hook_menu() {
$items = parent::hook_menu();
$id_count = count(explode('/', $this->path));
$wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%entity_object';
$items[$this->path]['description'] = 'Manage links that trigger rules.';
$items[$this->path . '/manage/' . $wildcard . '/components'] = array(
'title' => t('Configure rules'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'rules_link_component_form',
$this->entityType,
$id_count + 1,
),
'load arguments' => array(
$this->entityType,
),
'access callback' => 'entity_access',
'access arguments' => array(
'update',
$this->entityType,
$id_count + 1,
),
'file' => 'rules_link.admin.inc',
'file path' => drupal_get_path('module', 'rules_link'),
'type' => MENU_LOCAL_TASK,
'weight' => 2,
);
return $items;
}
/**
* Overrides EntityDefaultUIController::overviewTableHeaders().
*/
protected function overviewTableHeaders($conditions, $rows, $additional_header = array()) {
$additional_header[] = t('Entity');
return parent::overviewTableHeaders($conditions, $rows, $additional_header);
}
/**
* Overrides EntityDefaultUIController::overviewTableRow().
*/
protected function overviewTableRow($conditions, $id, $entity, $additional_cols = array()) {
// Add a column showing the entity type.
$entity_info = entity_get_info($entity->entity_type);
$additional_cols[] = $entity_info['label'];
return parent::overviewTableRow($conditions, $id, $entity, $additional_cols);
}
/**
* Overrides EntityDefaultUIController::entityFormSubmitBuildEntity().
*/
public function entityFormSubmitBuildEntity($form, &$form_state) {
$rules_link = $form_state[$this->entityType];
$values = $form_state['values'];
$rules_link->name = $values['name'];
$rules_link->label = $values['label'];
$rules_link->entity_type = $values['entity_type'];
$rules_link->path = $values['path'];
$rules_link->settings['text'] = $values['text'];
$rules_link->settings['link_type'] = $values['link_type'];
$rules_link->settings['bundles'] = $values['bundles'];
$rules_link->settings['entity_link'] = isset($values['entity_link']) ? $values['entity_link'] : '';
$rules_link->settings['view_mode'] = isset($values['view_mode']) ? $values['view_mode'] : '';
if ($rules_link->settings['link_type'] == 'confirm') {
$rules_link->settings['confirm_question'] = $values['question'];
$rules_link->settings['confirm_description'] = $values['description'];
}
return $rules_link;
}
}