You are here

function panelizer_has_choice_callback in Panelizer 7.3

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

Menu callback to determine if a type has a choice of defaults.

We use this to make sure the right tabs appear.

1 call to panelizer_has_choice_callback()
panelizer_has_choice_callback_view_mode in ./panelizer.module
Menu callback to determine if a type+view_mode has a choice of defaults.
1 string reference to 'panelizer_has_choice_callback'
panelizer_defaults_ui::hook_menu in plugins/export_ui/panelizer_defaults_ui.class.php
hook_menu() entry point.

File

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

Code

function panelizer_has_choice_callback($handler, $bundle, $name = NULL) {
  if (is_string($handler)) {
    $handler = panelizer_entity_plugin_get_handler($handler);
  }
  if (empty($handler)) {
    return FALSE;
  }
  if (!panelizer_administer_entity_bundle($handler, $bundle)) {
    return FALSE;
  }

  // Check to see if $name is valid.
  if (!empty($name) && !$handler
    ->get_default_panelizer_object($bundle, $name)) {
    return FALSE;
  }
  return $handler
    ->has_panel_choice($bundle);
}