You are here

function merci_restrictions_get_action_title in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

File

merci_restrictions/merci_restrictions.module, line 189

Code

function merci_restrictions_get_action_title($op, $entity_type, $bundle_name = NULL) {
  $info = entity_get_info($entity_type);
  $merci_restrictions_types = merci_restrictions_types();

  // Bypass the node/add listing if only one content type is available.
  if (count($merci_restrictions_types) == 1) {

    // Get entity info for our bundles.
    $info = entity_get_info($entity_type);
    $type = reset($merci_restrictions_types);
    $bundle_name = isset($bundle_name) ? $bundle_name : $type->type;
    switch ($op) {
      case 'add':
        if (isset($bundle_name) && $bundle_name != $entity_type) {
          return t('Add @bundle_name', array(
            '@bundle_name' => drupal_strtolower($info['bundles'][$bundle_name]['label']),
          ));
        }
        else {
          return t('Add @entity_type', array(
            '@entity_type' => drupal_strtolower($info['label']),
          ));
        }
      case 'import':
        return t('Import @entity_type', array(
          '@entity_type' => drupal_strtolower($info['label']),
        ));
    }
  }
  return entity_ui_get_action_title($op, $entity_type, $bundle_name);
}