You are here

public function EntityLegalDocumentVersionUIController::hook_menu in Entity Legal 7

Same name and namespace in other branches
  1. 7.2 entity_legal.entity_admin.inc \EntityLegalDocumentVersionUIController::hook_menu()

Provides definitions for implementing hook_menu().

Overrides EntityDefaultUIController::hook_menu

File

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

Class

EntityLegalDocumentVersionUIController
Legal Document Version entity ui controller.

Code

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