1 layout.module layout_entity_menu_title($entity_type, $bundle_arg)

Title callback: Returns a label for the action link to create bundle layouts.

Parameters

string $entity_type: The entity type such as "node", "user", "taxonomy_term", etc.

string|stdClass $bundle_arg: The bundle as a string or object. The object may be a TaxonomyVocabulary or stdClass (in the case of a node type).

Return value

string: The translated label used for the local actions.

See also

layout_menu()

File

core/modules/layout/layout.module, line 708
The Layout module creates pages and wraps existing pages in layouts.

Code

function layout_entity_menu_title($entity_type, $bundle_arg) {
  module_load_include('inc', 'layout', 'layout.entity.admin');
  $entity_info = entity_get_info($entity_type);
  $single_bundle = (count($entity_info['bundles']) == 1) && isset($entity_info['bundles'][$entity_type]);

  if (!$single_bundle) {
    $bundle_label = _layout_entity_bundle_label($entity_type, $bundle_arg);
    return t('Add @bundle_label layout', array('@bundle_label' => $bundle_label));
  }
  else {
    return t('Add @entity layout', array('@entity' => $entity_info['label']));
  }
}