You are here

public function BatBookingUIController::hook_menu in Booking and Availability Management Tools for Drupal 7

Overrides hook_menu() defaults.

Overrides EntityDefaultUIController::hook_menu

File

modules/bat_booking/bat_booking.admin.inc, line 16
BatBooking editing UI.

Class

BatBookingUIController
UI controller.

Code

public function hook_menu() {
  $items = parent::hook_menu();

  // Change the add page menu to multiple types of entities.
  $items[$this->path . '/add']['title'] = 'Add a Booking';
  $items[$this->path . '/add']['description'] = 'Create a new booking.';
  $items[$this->path . '/add']['page callback'] = 'bat_booking_add_page';
  $items[$this->path . '/add']['access callback'] = 'bat_booking_add_access';
  unset($items[$this->path . '/add']['title callback']);

  // Add menu items to add each different type of bookings.
  foreach (bat_booking_get_types() as $booking_type) {
    $items[$this->path . '/add/' . $booking_type->type] = array(
      'title' => 'Add @booking_type_label booking',
      'title arguments' => array(
        '@booking_type_label' => $booking_type->label,
      ),
      'page callback' => 'bat_booking_create_form_wrapper',
      'page arguments' => array(
        $booking_type->type,
      ),
      'access callback' => 'bat_booking_access',
      'access arguments' => array(
        'create',
        bat_booking_create(array(
          'type' => $booking_type->type,
          'uid' => 0,
        )),
      ),
      'file' => 'bat_booking.admin.inc',
      'file path' => drupal_get_path('module', $this->entityInfo['module']),
    );
  }
  return $items;
}