You are here

class RulesLinkUIController in Rules Link 7

Same name and namespace in other branches
  1. 7.2 rules_link.admin.inc \RulesLinkUIController

UI controller.

Hierarchy

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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityDefaultUIController::$entityInfo protected property
EntityDefaultUIController::$entityType protected property
EntityDefaultUIController::$id_count protected property
EntityDefaultUIController::$overviewPagerLimit public property Defines the number of entries to show per page in overview table.
EntityDefaultUIController::applyOperation public function Applies an operation to the given entity.
EntityDefaultUIController::hook_forms public function Provides definitions for implementing hook_forms().
EntityDefaultUIController::operationCount protected function Returns the operation count for calculating colspans.
EntityDefaultUIController::operationForm public function Builds the operation form.
EntityDefaultUIController::operationFormSubmit public function Operation form submit callback. 1
EntityDefaultUIController::operationFormValidate public function Operation form validation callback.
EntityDefaultUIController::overviewForm public function Builds the entity overview form.
EntityDefaultUIController::overviewFormSubmit public function Overview form submit callback.
EntityDefaultUIController::overviewFormValidate public function Overview form validation callback.
EntityDefaultUIController::overviewTable public function Generates the render array for a overview table for arbitrary entities matching the given conditions.
EntityDefaultUIController::__construct public function
RulesLinkUIController::entityFormSubmitBuildEntity public function Overrides EntityDefaultUIController::entityFormSubmitBuildEntity(). Overrides EntityDefaultUIController::entityFormSubmitBuildEntity
RulesLinkUIController::hook_menu public function Overrides EntityDefaultUIController::hook_menu() defaults. Overrides EntityDefaultUIController::hook_menu
RulesLinkUIController::overviewTableHeaders protected function Overrides EntityDefaultUIController::overviewTableHeaders(). Overrides EntityDefaultUIController::overviewTableHeaders
RulesLinkUIController::overviewTableRow protected function Overrides EntityDefaultUIController::overviewTableRow(). Overrides EntityDefaultUIController::overviewTableRow