You are here

class EntityLegalDocumentVersionUIController in Entity Legal 7

Same name and namespace in other branches
  1. 7.2 entity_legal.entity_admin.inc \EntityLegalDocumentVersionUIController

Legal Document Version entity ui controller.

Hierarchy

Expanded class hierarchy of EntityLegalDocumentVersionUIController

1 string reference to 'EntityLegalDocumentVersionUIController'
entity_legal_entity_info in ./entity_legal.module
Implements hook_entity_info().

File

./entity_legal.entity_admin.inc, line 100
Admin ui controllers for entity_legal entities.

View source
class EntityLegalDocumentVersionUIController extends EntityDefaultUIController {

  /**
   * {@inheritdoc}
   */
  public function hook_menu() {
    $items = parent::hook_menu();

    // Remove title callbacks that cause bundle notices.
    foreach ($items as &$item) {
      if (isset($item['title callback']) && $item['title callback'] == 'entity_ui_get_action_title') {
        unset($item['title callback']);
        $item['title'] = ucfirst($item['title arguments'][0]);
      }
    }

    // Remove the overview path.
    unset($items[$this->path]);
    unset($items[$this->path . '/list']);
    $wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%entity_object';
    $this->id_count = count(explode('/', $this->path));
    $bundle_argument = 4;

    // Add bundle to add form.
    $items[$this->path . '/add']['title'] = 'Add new version';
    $items[$this->path . '/add']['page callback'] = 'entity_legal_document_version_ui_get_form';
    $items[$this->path . '/add']['page arguments'] = array(
      NULL,
      $bundle_argument,
      'add',
    );

    // Add bundle to edit form.
    $items[$this->path . '/manage/' . $wildcard]['page callback'] = 'entity_legal_document_version_ui_get_form';
    $items[$this->path . '/manage/' . $wildcard]['page arguments'] = array(
      $this->id_count + 1,
      $bundle_argument,
      'edit',
    );

    // Add bundle to edit form.
    $items[$this->path . '/manage/' . $wildcard . '/edit']['page callback'] = 'entity_legal_document_version_ui_get_form';
    $items[$this->path . '/manage/' . $wildcard . '/edit']['page arguments'] = array(
      $this->id_count + 1,
      $bundle_argument,
      'edit',
    );
    return $items;
  }

  /**
   * {@inheritdoc}
   */
  public function hook_forms() {
    $forms = parent::hook_forms();

    // Rewrite form ids to include the module name as a prefix.
    if (!(count($this->entityInfo['bundles']) == 1 && isset($this->entityInfo['bundles'][$this->entityType]))) {
      foreach ($this->entityInfo['bundles'] as $bundle => $bundle_info) {
        $forms[$this->entityType . '_edit_' . $bundle . '_form']['callback'] = 'entity_legal_document_version_form';
      }
    }
    return $forms;
  }

}

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::entityFormSubmitBuildEntity public function Entity submit builder invoked via entity_ui_form_submit_build_entity().
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::overviewTableHeaders protected function Generates the table headers for the overview table.
EntityDefaultUIController::overviewTableRow protected function Generates the row for the passed entity and may be overridden in order to customize the rows.
EntityDefaultUIController::__construct public function
EntityLegalDocumentVersionUIController::hook_forms public function Provides definitions for implementing hook_forms(). Overrides EntityDefaultUIController::hook_forms
EntityLegalDocumentVersionUIController::hook_menu public function Provides definitions for implementing hook_menu(). Overrides EntityDefaultUIController::hook_menu