function panels_ajax_tab_prepare_mini in Panels Ajax Tabs 7
Prepares the mini-panel.
2 calls to panels_ajax_tab_prepare_mini()
- panels_ajax_tab_ajax in ./
panels_ajax_tab.module - AJAX callback for rendering tab.
- panels_ajax_tab_container_render in plugins/
content_types/ panels_ajax_tab_container.inc - Rendering function for the 'panels_ajax_tab_container' content type.
File
- ./
panels_ajax_tab.module, line 215 - Allows users to create and manage Panels Ajax Tabs.
Code
function panels_ajax_tab_prepare_mini($mini, $context_string) {
ctools_include('context');
ctools_include('plugins');
ctools_include('plugins', 'panels');
if (is_string($mini)) {
$mini = panels_mini_load($mini);
}
if ($context_string != 'none') {
$entity = panels_ajax_tab_get_context($context_string);
if (!$entity) {
drupal_not_found();
exit;
}
// If it's a node, check node-view permissions.
if ($entity->entity_type == 'node') {
if (!node_access('view', $entity)) {
drupal_access_denied();
exit;
}
}
$context_plugin = ctools_get_plugins('ctools', 'contexts', 'entity');
$context_plugin['keyword'] = $entity->entity_type;
$context = ctools_context_create_entity(FALSE, $entity, FALSE, $context_plugin);
// Load up any contexts we might be using.
$context = ctools_context_match_required_contexts($mini->requiredcontexts, array(
$context,
));
$mini->context = $mini->display->context = ctools_context_load_contexts($mini, FALSE, $context);
}
if (empty($mini) || !empty($mini->disabled)) {
return;
}
$mini->display->owner = $mini;
// Unique ID of this mini.
$mini->display->owner->id = $mini->name;
return $mini;
}