You are here

class EntityContentUIController in Entity API 7

UI controller providing UI for content entities.

For a controller providing UI for bundleable content entities, see EntityBundleableUIController. For a controller providing admin UI for configuration entities, see EntityDefaultUIController.

Hierarchy

Expanded class hierarchy of EntityContentUIController

File

includes/entity.ui.inc, line 509
Provides a controller for building an entity overview form.

View source
class EntityContentUIController extends EntityDefaultUIController {

  /**
   * Provides definitions for implementing hook_menu().
   */
  public function hook_menu() {
    $items = parent::hook_menu();
    $wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%entity_object';

    // Unset the manage entity path, as the provided UI is for admin entities.
    unset($items[$this->path]);
    $defaults = array(
      'file' => $this->entityInfo['admin ui']['file'],
      'file path' => isset($this->entityInfo['admin ui']['file path']) ? $this->entityInfo['admin ui']['file path'] : drupal_get_path('module', $this->entityInfo['module']),
    );

    // Add view, edit and delete menu items for content entities.
    $items[$this->path . '/' . $wildcard] = array(
      'title callback' => 'entity_ui_get_page_title',
      'title arguments' => array(
        'view',
        $this->entityType,
        $this->id_count,
      ),
      'page callback' => 'entity_ui_entity_page_view',
      'page arguments' => array(
        $this->id_count,
      ),
      'load arguments' => array(
        $this->entityType,
      ),
      'access callback' => 'entity_access',
      'access arguments' => array(
        'view',
        $this->entityType,
        $this->id_count,
      ),
    ) + $defaults;
    $items[$this->path . '/' . $wildcard . '/view'] = array(
      'title' => 'View',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'load arguments' => array(
        $this->entityType,
      ),
      'weight' => -10,
    ) + $defaults;
    $items[$this->path . '/' . $wildcard . '/edit'] = array(
      'page callback' => 'entity_ui_get_form',
      'page arguments' => array(
        $this->entityType,
        $this->id_count,
      ),
      'load arguments' => array(
        $this->entityType,
      ),
      'access callback' => 'entity_access',
      'access arguments' => array(
        'edit',
        $this->entityType,
        $this->id_count,
      ),
      'title' => 'Edit',
      'type' => MENU_LOCAL_TASK,
      'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    ) + $defaults;
    $items[$this->path . '/' . $wildcard . '/delete'] = array(
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        $this->entityType . '_operation_form',
        $this->entityType,
        $this->id_count,
        'delete',
      ),
      'load arguments' => array(
        $this->entityType,
      ),
      'access callback' => 'entity_access',
      'access arguments' => array(
        'delete',
        $this->entityType,
        $this->id_count,
      ),
      'title' => 'Delete',
      'type' => MENU_LOCAL_TASK,
      'context' => MENU_CONTEXT_INLINE,
      'file' => $this->entityInfo['admin ui']['file'],
      'file path' => isset($this->entityInfo['admin ui']['file path']) ? $this->entityInfo['admin ui']['file path'] : drupal_get_path('module', $this->entityInfo['module']),
    ) + $defaults;
    return $items;
  }

  /**
   * Operation form submit callback.
   */
  public function operationFormSubmit($form, &$form_state) {
    parent::operationFormSubmit($form, $form_state);

    // The manage entity path is unset for the content entity UI.
    $form_state['redirect'] = '<front>';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityContentUIController::hook_menu public function Provides definitions for implementing hook_menu(). Overrides EntityDefaultUIController::hook_menu 1
EntityContentUIController::operationFormSubmit public function Operation form submit callback. Overrides EntityDefaultUIController::operationFormSubmit
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::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::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