function custom_breadcrumbs_panels_ctools_render_alter in Custom Breadcrumbs 7.2
Same name and namespace in other branches
- 6.2 custom_breadcrumbs_panels/custom_breadcrumbs_panels.module \custom_breadcrumbs_panels_ctools_render_alter()
Implements hook_ctools_render_alter().
File
- custom_breadcrumbs_panels/
custom_breadcrumbs_panels.module, line 111
Code
function custom_breadcrumbs_panels_ctools_render_alter($info, $page, $data) {
// Don't really do anything with the panel. This is just a pretense to insert
// a breadcrumb.
static $module_weights = array();
extract($data);
if ($page) {
global $language;
$languages = array(
'language' => $language->language,
'all' => '',
);
// Check to see if the panel ID matches any custom_breadcrumb panel_id.
// First, try to find a match on panels variant id.
// @codingStandardsIgnoreLine
$id = $handler->name;
$breadcrumbs = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbs_panels', NULL, array(
'panel_id' => $id,
), $languages);
// If nothing matched, try matching on panels page id.
if (empty($breadcrumbs)) {
// @codingStandardsIgnoreLine
$id = $handler->task;
$breadcrumbs = custom_breadcrumbs_load_breadcrumbs('custom_breadcrumbs_panels', NULL, array(
'panel_id' => $id,
), $languages);
}
if (!empty($breadcrumbs)) {
if ($breadcrumb = custom_breadcrumbs_select_breadcrumb($breadcrumbs, array(
'panel' => $info,
))) {
$objs = array(
'panel' => $info,
);
// @codingStandardsIgnoreLine
foreach ($contexts as $context) {
if (is_array($context->type) && (in_array('node', $context->type) || in_array('entity:node', $context->type)) && isset($context->data)) {
$objs['node'] = $context->data;
}
}
// @codingStandardsIgnoreStart
if (!empty($handler->conf['display'])) {
foreach ($handler->conf['display']->content as $pane) {
// @codingStandardsIgnoreEnd
if ($pane->type == 'node') {
$objs['node'] = node_load($pane->configuration['nid']);
}
}
}
custom_breadcrumbs_set_breadcrumb($breadcrumb, $objs);
// Stop after a match has been found.
return;
}
}
}
// Is this a taxonomy term template?
// @codingStandardsIgnoreLine
if (isset($task['admin path']) && $task['admin path'] == "taxonomy/term/%taxonomy_term" && module_exists('custom_breadcrumbs_taxonomy') && variable_get('custom_breadcrumbs_taxonomy_panels', FALSE)) {
module_load_include('inc', 'custom_breadcrumbs_taxonomy');
// @codingStandardsIgnoreLine
foreach ($contexts as $context) {
if (isset($context->data->tid)) {
$terms = array(
$context->data->tid => $context->data,
);
_custom_breadcrumbs_taxonomy_set_breadcrumb($context->data->tid, $context->data->vid, TRUE, array(), $terms);
return;
}
}
}
// Is this a node template?
// @codingStandardsIgnoreLine
if (isset($task['admin path']) && $task['admin path'] == "node/%node") {
$context = array_pop($contexts);
if (is_array($context->type) && (in_array('node', $context->type) || in_array('entity:node', $context->type)) && isset($context->data)) {
$node = $context->data;
// Call hook_nodeapi for each Custom Breadcrumbs submodule in order of the
// module's weight.
if (empty($module_weights)) {
$modules = module_implements('cb_breadcrumb_info');
$module_weights = _custom_breadcrumbs_get_module_weight($modules);
unset($module_weights['custom_breadcrumbs_panels']);
}
foreach ($module_weights as $module_name => $weight) {
$func = $module_name . '_node_view';
if (function_exists($func)) {
$func($node, 'full');
}
}
return;
}
}
if (variable_get('custom_breadcrumbs_set_menu_breadcrumb', FALSE)) {
// If a panels breadcrumb has not been defined for this panel, then use the
// default menu structure.
custom_breadcrumbs_set_menu_breadcrumb();
}
}