Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save junaidpv/16b3351f6ff94159b2a4e659ddde4d9b to your computer and use it in GitHub Desktop.

Select an option

Save junaidpv/16b3351f6ff94159b2a4e659ddde4d9b to your computer and use it in GitHub Desktop.
Custom patch/hack for custom_breadcrumbs module, so that configuration from "Custom breadcrumb for Panel Page" will copy to panel variant configuration while the page being rendered. It helps to translate breadcrumbs in panel pages.
diff --git a/custom_breadcrumbs_panels/custom_breadcrumbs_panels.module b/custom_breadcrumbs_panels/custom_breadcrumbs_panels.module
index d1e4465..c3a677e 100644
--- a/custom_breadcrumbs_panels/custom_breadcrumbs_panels.module
+++ b/custom_breadcrumbs_panels/custom_breadcrumbs_panels.module
@@ -98,10 +98,24 @@ function custom_breadcrumbs_panels_node_view($node, $build_mode) {
}
}
+/**
+ * Implements hook_module_implements_alter().
+ */
+function custom_breadcrumbs_panels_module_implements_alter(&$implementations, $hook) {
+ if (module_exists('panels_breadcrumbs')) {
+ if ($hook == 'ctools_render_alter') {
+ // Make sure panels_breadcrumbs's version is called last.
+ $group = $implementations['panels_breadcrumbs'];
+ unset($implementations['panels_breadcrumbs']);
+ $implementations['panels_breadcrumbs'] = $group;
+ }
+ }
+}
+
/**
* Implements hook_ctools_render_alter().
*/
-function custom_breadcrumbs_panels_ctools_render_alter($info, $page, $data) {
+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);
@@ -133,7 +147,14 @@ function custom_breadcrumbs_panels_ctools_render_alter($info, $page, $data) {
$objs['node'] = node_load($pane->configuration['nid']);
}
}
- custom_breadcrumbs_set_breadcrumb($breadcrumb, $objs);
+ if (module_exists('panels_breadcrumbs')) {
+ $handler = &$data['handler'];
+ $handler->conf['panels_breadcrumbs_titles'] = $breadcrumb->titles;
+ $handler->conf['panels_breadcrumbs_paths'] = $breadcrumb->paths;
+ }
+ else {
+ custom_breadcrumbs_set_breadcrumb($breadcrumb, $objs);
+ }
// Stop after a match has been found.
return;
}
@@ -267,3 +288,4 @@ function custom_breadcrumbs_panels_form($form, &$form_state, $type) {
return $form;
}
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment