You are here

function theme_bat_type_unit_add_list in Booking and Availability Management Tools for Drupal 7

Displays the list of available Unit bundles for Unit creation.

1 theme call to theme_bat_type_unit_add_list()
BatTypeUIController::addUnitsPage in modules/bat_unit/bat_type.admin.inc
Creates the markup for the add Bat Units pages when units are added through the Type configuration page.

File

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

Code

function theme_bat_type_unit_add_list($variables) {
  $bundles = $variables['content']['bundles'];
  $item = $variables['content']['item'];
  if ($bundles) {
    $output = '<dl class="unit-type-list">';
    foreach ($bundles as $unit_bundle) {
      $output .= '<dt>' . l(t('Add @unit_bundle', array(
        '@unit_bundle' => $unit_bundle->label,
      )), $item['href'] . '/' . $unit_bundle->type) . '</dt>';
      $output .= '<dd>' . filter_xss_admin($item['description']) . '</dd>';
    }
    $output .= '</dl>';
  }
  else {
    if (user_access('administer type bundles')) {
      $output = '<p>' . t('Unit cannot be added because you have not created any Unit bundles yet. Go to the <a href="@create-unit_bundle">unit bundle creation page</a> to add a new unit bundle.', array(
        '@create-unit_bundle' => url('admin/bat/config/unit-bundles/add'),
      )) . '</p>';
    }
    else {
      $output = '<p>' . t('No Unit bundles have been created yet.') . '</p>';
    }
  }
  return $output;
}