You are here

function panelizer_default_title_callback in Panelizer 7.3

Same name and namespace in other branches
  1. 6 panelizer.module \panelizer_default_title_callback()
  2. 7 panelizer.module \panelizer_default_title_callback()
  3. 7.2 panelizer.module \panelizer_default_title_callback()

Title callback to properly set the tile when editing panelizer defaults.

1 string reference to 'panelizer_default_title_callback'
panelizer_admin_hook_menu in includes/admin.inc
Delegated hook_menu for admin

File

./panelizer.module, line 944
The Panelizer module attaches panels to entities, providing default panels and allowing each panel to be configured independently by privileged users.

Code

function panelizer_default_title_callback($handler, $bundle) {
  if (is_string($handler)) {
    $handler = panelizer_entity_plugin_get_handler($handler);
  }
  if (!$handler) {
    return '';
  }
  $entity_info = entity_get_info($handler->entity_type);
  $title = $entity_info['label'];
  if (strpos($bundle, '.') === FALSE) {
    $bundle = $bundle;
    $view_mode = '';
  }
  else {
    list($bundle, $view_mode) = explode('.', $bundle);
  }
  $title .= ' | ' . $handler
    ->get_bundle_title($bundle);
  if ($view_mode && !empty($handler->plugin['view modes'][$view_mode]['label'])) {
    $title .= ' | ' . $handler->plugin['view modes'][$view_mode]['label'];
  }
  return $title;
}