diff --git a/CHANGELOG.md b/CHANGELOG.md index 269e69b..e22edff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ Changelog Note: the theme contains the University's house style assets (CSS, images, JavaScript). For the sake of completeness, all updates to these are also listed below. +7.x-1.8 + +* Updated the theme to take into account the changes in the latest version of Easy Breadcrumb module 7.x-2.13. Their theme layer has changed completely and we have had to match the changes to allow us to continue to use easy breadcrumb in some Cambridge sites. If you are using easy breadcrumb prior to 7.x-2.13 you will need to upgrade to this version of the module if you wish to continue using easy breadcrumb and the Cambridge theme. + +7.x-1.7 + +* Updated code comments. + 7.x-1.6 * Updated code comments. diff --git a/template.php b/template.php index 98239b3..4aa963f 100644 --- a/template.php +++ b/template.php @@ -42,13 +42,15 @@ function cambridge_theme_theme($existing, $type, $theme, $path) { 'render element' => 'element', ), 'cambridge_easy_breadcrumb' => array( - 'function' => 'theme_cambridge_easy_breadcrumb', 'variables' => array( 'breadcrumb' => NULL, 'segments_quantity' => NULL, 'separator' => NULL, - ), + ), + 'template' => 'easy-breadcrumb', + 'path' => drupal_get_path('theme', 'cambridge_theme') . '/templates', ), + ); } @@ -673,6 +675,7 @@ function cambridge_theme_block_view_alter(&$data, $block) { $data['content']['#content']['#below']['navigation']['#below'][$key]['#below']['#theme_wrappers'] = array(array('cambridge_theme_left_navigation_children')); } } + } /** @@ -1239,57 +1242,61 @@ function cambridge_theme_breadcrumb($breadcrumbs) { return $html; } -/** - * Implements hook_block_view_MODULE_DELTA_alter() for the Easy Breadcrumb module's Easy Breadcrumb block. - */ -function cambridge_theme_block_view_easy_breadcrumb_easy_breadcrumb_alter(&$data, $block) { - $data['content']['easy_breadcrumb']['#theme'] = 'cambridge_easy_breadcrumb'; -} -/** - * Style the Easy Breadcrumb module's Easy Breadcrumb block. +/* + * Implementation of a preprocess hook for easy breadcrumb module. + * When easy breadcrumb changed from version 2.12 to 2.13, they changed the + * module worked from a theme function to a tpl file and preprocess function. + * We have had to adapt our theme to match their new setup. + * + * This function has replaced the theme easy breadcrumb function in the + * earlier versions of the theme. + * JAG212 - 26th July 2017. */ -function theme_cambridge_easy_breadcrumb($variables) { - $breadcrumbs = $variables['breadcrumb']; - $segments_quantity = $variables['segments_quantity']; - - if (count($breadcrumbs) <= 1) { - return ''; - } +function cambridge_preprocess_easy_breadcrumb(&$variables) { + $breadcrumbs = _easy_breadcrumb_build_items(); + if (module_exists('schemaorg')) { + $variables['list_type'] = 'https://schema.org/BreadcrumbList'; + } + else { + $variables['list_type'] = 'http://data-vocabulary.org/Breadcrumb'; + } - $html = ''; + // Loop round all breadcrumbs + foreach ($breadcrumbs as $i => $breadcrumb) { + $content = decode_entities($breadcrumb['content']); - if ($segments_quantity > 0) { - $html .= ''; - } - return $html; + /* Segmentation handled by
  • styling background so we don't need this. */ + //$variables['segments_quantity'] = count($variables['breadcrumb']); + //$variables['seperator_ending'] = variable_get(EasyBreadcrumbConstants::DB_VAR_SEPERATOR_ENDING, FALSE) ? 0 : 1; + //$variables['separator'] = filter_xss(variable_get(EasyBreadcrumbConstants::DB_VAR_SEGMENTS_SEPARATOR, '>>')); } /** diff --git a/templates/easy-breadcrumb.tpl.php b/templates/easy-breadcrumb.tpl.php new file mode 100644 index 0000000..d2b3a7b --- /dev/null +++ b/templates/easy-breadcrumb.tpl.php @@ -0,0 +1,9 @@ + 0): ?> + + \ No newline at end of file