From f9d0f18325f49be9fed012d820dc650bfa9b3a56 Mon Sep 17 00:00:00 2001 From: laryn Date: Thu, 13 May 2021 11:46:09 -0500 Subject: [PATCH] Fix data-vocabulary.org schema deprecated error Fixes #13 --- easy_breadcrumb.module | 21 +++++++++++---------- templates/easy-breadcrumb.tpl.php | 11 +++++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/easy_breadcrumb.module b/easy_breadcrumb.module index 5310f6e..cd1f238 100644 --- a/easy_breadcrumb.module +++ b/easy_breadcrumb.module @@ -123,23 +123,24 @@ function easy_breadcrumb_block_view($delta = NULL) { */ function template_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'; - } + $variables['list_type'] = 'https://schema.org/BreadcrumbList'; foreach ($breadcrumbs as $i => $breadcrumb) { if (isset($breadcrumb['url'])) { - $variables['breadcrumb'][$i] = ''; + $variables['breadcrumb'][$i] = ''; $parsed_query = ''; $parsed_url = parse_url($breadcrumb['url']); if (isset($parsed_url['query'])) { parse_str($parsed_url['query'], $parsed_query); } - $variables['breadcrumb'][$i] .= l($breadcrumb['content'], $parsed_url['path'], array( - 'attributes' => array('class' => $breadcrumb['class']), + $variables['breadcrumb'][$i] .= l('' . $breadcrumb['content'] . '', $parsed_url['path'], array( + 'attributes' => array( + 'class' => $breadcrumb['class'], + 'itemtype' => "http://schema.org/Thing", + 'itemprop' => "item", + 'itemscope' => "", + 'itemid' => check_plain(url($breadcrumb['url'], array('absolute' => TRUE,))), + ), 'query' => $parsed_query, 'html' => (!empty($breadcrumb['html'])) ? $breadcrumb['html'] : FALSE, )); @@ -148,7 +149,7 @@ function template_preprocess_easy_breadcrumb(&$variables) { } else { $class = implode(' ', $breadcrumb['class']); - $variables['breadcrumb'][$i] = '' . $breadcrumb['content'] . ''; + $variables['breadcrumb'][$i] = '' . $breadcrumb['content'] . ''; } } $variables['segments_quantity'] = isset($variables['breadcrumb']) ? count($variables['breadcrumb']) : 0; diff --git a/templates/easy-breadcrumb.tpl.php b/templates/easy-breadcrumb.tpl.php index 735e1dc..e1d7df4 100644 --- a/templates/easy-breadcrumb.tpl.php +++ b/templates/easy-breadcrumb.tpl.php @@ -2,10 +2,13 @@