public function BatUnitUIController::addPage in Booking and Availability Management Tools for Drupal 7
Creates the markup for the add Unit Entities page within the class so it can easily be extended/overridden.
File
- modules/
bat_unit/ bat_unit.admin.inc, line 108 - BatUnit editing UI.
Class
- BatUnitUIController
- UI controller.
Code
public function addPage() {
$item = menu_get_item();
$bundles = bat_unit_get_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 @unit_bundle_label unit', array(
'@unit_bundle_label' => $bundle->label,
)),
'href' => $this->path . '/add/' . $bundle->type,
'description' => '',
);
}
return array(
'#theme' => 'bat_unit_add_list',
'#content' => $items,
);
}