You are here

function entity_ui_get_action_title in Entity API 7

Gets the page/menu title for local action operations.

Parameters

$op: The current operation. One of 'add' or 'import'.

$entity_type: The entity type.

$bundle_name: (Optional) The name of the bundle. May be NULL if the bundle name is not relevant to the current page. If the entity type has only one bundle, or no bundles, this will be the same as the entity type.

2 calls to entity_ui_get_action_title()
entity_ui_bundle_add_page in ./entity.module
Page callback to show links to add an entity of a specific bundle.
entity_ui_get_page_title in ./entity.module
Gets the page title for the passed operation.
2 string references to 'entity_ui_get_action_title'
EntityBundleableUIController::hook_menu in includes/entity.ui.inc
Provides definitions for implementing hook_menu().
EntityDefaultUIController::hook_menu in includes/entity.ui.inc
Provides definitions for implementing hook_menu().

File

./entity.module, line 1309

Code

function entity_ui_get_action_title($op, $entity_type, $bundle_name = NULL) {
  $info = entity_get_info($entity_type);
  switch ($op) {
    case 'add':
      if (isset($bundle_name) && $bundle_name != $entity_type) {
        return t('Add @bundle_name @entity_type', array(
          '@bundle_name' => drupal_strtolower($info['bundles'][$bundle_name]['label']),
          '@entity_type' => drupal_strtolower($info['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']),
      ));
  }
}