You are here

public function BatTypeUIController::addPage in Booking and Availability Management Tools for Drupal 7

Creates the markup for the add Bat Type Entities page within the class so it can easily be extended/overridden.

File

modules/bat_unit/bat_type.admin.inc, line 281
BatType editing UI.

Class

BatTypeUIController
UI controller.

Code

public function addPage() {
  $item = menu_get_item();
  $bundles = bat_unit_get_type_bundles();

  // If there is only one unit bundle go straight to that page.
  if (count($bundles) == 1) {
    $bundle = reset($bundles);
    drupal_goto($this->path . '/add/' . $bundle->type);
  }
  $items = array();
  foreach ($bundles as $bundle) {
    $items[] = array(
      'title' => t('Add @type_bundle_label type', array(
        '@type_bundle_label' => $bundle->label,
      )),
      'href' => $this->path . '/add/' . $bundle->type,
      'description' => '',
    );
  }
  return array(
    '#theme' => 'bat_type_add_list',
    '#content' => $items,
  );
}