function panelizer_export_ui_switcher_page in Panelizer 7.2
Same name and namespace in other branches
- 7.3 panelizer.module \panelizer_export_ui_switcher_page()
Specialized version of ctools_export_ui_switcher_page()
This one is designed to set our entity handler and bundle on the object so we can refer to it later without having to override all of the entry points.
2 string references to 'panelizer_export_ui_switcher_page'
- PanelizerEntityDefault::add_admin_links in plugins/
entity/ PanelizerEntityDefault.class.php - Helper function to add administrative menu items into an entity's already existing structure.
- panelizer_defaults_ui::hook_menu in plugins/
export_ui/ panelizer_defaults_ui.class.php - hook_menu() entry point.
File
- ./
panelizer.module, line 497 - The Panelizer module attaches panels to entities, providing default panels and allowing each panel to be configured independently by privileged users.
Code
function panelizer_export_ui_switcher_page($entity_handler, $bundle, $plugin_name, $op) {
$args = func_get_args();
// Remove the handler and the bundle.
array_shift($args);
array_shift($args);
$js = !empty($_REQUEST['js']);
// Load the $plugin information
$plugin = ctools_get_export_ui($plugin_name);
$handler = ctools_export_ui_get_handler($plugin);
if ($handler) {
if (is_string($entity_handler)) {
$entity_handler = panelizer_entity_plugin_get_handler($entity_handler);
}
$handler->entity_handler = $entity_handler;
$handler->entity_bundle = $bundle;
if (empty($entity_handler->entity_admin_root) || substr($_GET['q'], 30) == 'admin/config/content/panelizer') {
$handler->plugin['menu']['menu prefix'] = 'admin/config/content/panelizer/' . $entity_handler->entity_type;
$handler->plugin['menu']['menu item'] = $bundle;
}
else {
$base_path = $entity_handler->entity_admin_root . '/panelizer';
if (is_numeric($entity_handler->entity_admin_bundle)) {
$bits = explode('/', $base_path);
$bits[$entity_handler->entity_admin_bundle] = $bundle;
$base_path = implode('/', $bits);
}
$handler->plugin['menu']['menu prefix'] = dirname($base_path);
$handler->plugin['menu']['menu item'] = basename($base_path);
}
$path = $handler->plugin['menu']['menu prefix'] . '/' . $handler->plugin['menu']['menu item'];
foreach ($handler->plugin['redirect'] as $key => $old_path) {
if ($key == 'add') {
$handler->plugin['redirect'][$key] = $path . '/list/%ctools_export_ui/settings';
}
else {
$handler->plugin['redirect'][$key] = $path . '/list';
}
}
$method = $op . '_page';
if (method_exists($handler, $method)) {
// replace the first two arguments:
$args[0] = $js;
$args[1] = $_POST;
return call_user_func_array(array(
$handler,
$method,
), $args);
}
}
else {
return t('Configuration error. No handler found.');
}
}