You are here

public function UserpointsTransactionTypeUIController::hook_menu in User Points 7.2

Implements EntityDefaultUIController::hook_menu().

Make transaction type UI fit into userpoints menu structure.

Overrides EntityDefaultUIController::hook_menu

File

./userpoints.transaction.inc, line 1484
Contains the UserpointsTransaction and related classes.

Class

UserpointsTransactionTypeUIController
Transaction type UI.

Code

public function hook_menu() {
  $items = parent::hook_menu();
  $items[$this->path]['title'] = 'Transaction Types';
  $items[$this->path]['description'] = strtr('Manage !Points transaction types.', userpoints_translation());
  $items[$this->path]['type'] = MENU_LOCAL_TASK;
  $items[$this->path]['weight'] = 10;
  foreach ($items as $path => $item) {
    if (substr($path, strlen($this->path) + 1, 6) == 'manage') {

      // Field UI doesn't render local tasks well when the main ui is a local
      // task itself. This places all admin interfaces directly under types
      // instead.
      $new_path = preg_replace('/\\/manage/', '', $path);
      $items[$new_path] = $items[$path];
      $items[$new_path]['page arguments'][1] = 5;
      if (isset($items[$new_path]['page arguments'][0]) && $items[$new_path]['page arguments'][0] == 'userpoints_transaction_type_operation_form') {

        // Entity API fails to use the correct bundle argument defined in
        // entity info.
        $items[$new_path]['page arguments'] = array(
          'entity_ui_operation_form',
          'userpoints_transaction_type',
          5,
          6,
        );
      }
      unset($items[$path]);
    }
  }
  return $items;
}