You are here

public function UnitsUnitUIController::hook_menu in Units of Measurement 7.2

Same name and namespace in other branches
  1. 7 includes/UnitsUnitUIController.class.inc \UnitsUnitUIController::hook_menu()

Provides definitions for implementing hook_menu().

Overrides UnitsAbstractUIController::hook_menu

File

includes/UnitsUnitUIController.class.inc, line 20
Definition of UnitsUnitUIController class.

Class

UnitsUnitUIController
Admin UI controller class for entity type 'units_unit'.

Code

public function hook_menu() {

  // For this particular case we need to undo substitution of [bundle] to the
  // real bundle string made in __construct method of this class.
  $original_path = $this->path;
  $this->path = $this->entityInfo['admin ui']['path'];
  $items = parent::hook_menu();

  // We have to alter title for general overview page of entity admin UI,
  // to make it less confusing we need to include title of measure into it.
  $items[$this->path]['title callback'] = 'units_ui_unit_title';
  $items[$this->path]['title arguments'] = array(
    $this
      ->bundleArgumentPosition(),
  );

  // On the 'add' path, we need to provide info about the bundle of units
  // entity, so we have to slightly adjust the page callback and its
  // arguments in order to make it happen.
  $items[$this->path . '/add']['page callback'] = 'units_ui_entity_ui_get_bundle_add_form';
  $items[$this->path . '/add']['page arguments'] = array(
    $this->entityType,
    $this
      ->bundleArgumentPosition(),
  );

  // Putting back the original path once we are done.
  $this->path = $original_path;
  return $items;
}