diff --git a/path_breadcrumbs_ui/path_breadcrumbs_ui.admin.inc b/path_breadcrumbs_ui/path_breadcrumbs_ui.admin.inc --- a/path_breadcrumbs_ui/path_breadcrumbs_ui.admin.inc +++ b/path_breadcrumbs_ui/path_breadcrumbs_ui.admin.inc (date 1656599669399) @@ -152,6 +152,34 @@ ), ); + $form['path_breadcrumbs_theme']['path_breadcrumbs_list_element_tag'] = array( + '#type' => 'textfield', + '#title' => t('List Element HTML Tag'), + '#default_value' => variable_get('path_breadcrumbs_item_element_tag', 'ol'), + '#size' => 8, + '#description' => t('The HTML tag that should wrap the item list (excluding the angled brackets: <, >).'), + ); + + $form['path_breadcrumbs_theme']['path_breadcrumbs_item_element_tag'] = array( + '#type' => 'textfield', + '#title' => t('List Item Element HTML Tag'), + '#default_value' => variable_get('path_breadcrumbs_item_element_tag', 'li'), + '#size' => 8, + '#description' => t('The HTML tag that should wrap each list element (excluding the angled brackets: <, >).'), + ); + + $form['path_breadcrumbs_theme']['path_breadcrumbs_render_delimiter'] = array( + '#type' => 'checkbox', + '#title' => t('Render Delimiter'), + '#default_value' => variable_get('path_breadcrumbs_render_delimiter', FALSE), + '#description' => t('Whether the delimiter should be rendered in the HTML output.'), + '#states' => array( + 'disabled' => array( + ':input[name="path_breadcrumbs_internal_render"]' => array('checked' => FALSE), + ), + ), + ); + $form['path_breadcrumbs_theme']['path_breadcrumbs_delimiter'] = array( '#type' => 'textfield', '#title' => t('Delimiter'), @@ -160,7 +188,9 @@ '#description' => t('Symbol that separates breadcrumbs. HTML is not allowed. You can use .delimiter class name to style the delimiter in CSS.'), '#states' => array( 'disabled' => array( - ':input[name="path_breadcrumbs_internal_render"]' => array('checked' => FALSE), + array(':input[name="path_breadcrumbs_internal_render"]' => array('checked' => FALSE)), + 'or', + array(':input[name="path_breadcrumbs_render_delimiter"]' => array('checked' => FALSE)), ), ), ); Index: path_breadcrumbs.module IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/path_breadcrumbs.module b/path_breadcrumbs.module --- a/path_breadcrumbs.module +++ b/path_breadcrumbs.module (date 1656599543857) @@ -339,7 +339,7 @@ } // Add options for rich snippets. - $elem_tag = 'span'; + $elem_tag = variable_get('path_breadcrumbs_item_element_tag', 'li'); $elem_property = ''; $root_property = ''; $options = array('html' => TRUE); @@ -347,22 +347,27 @@ if ($snippet == PATH_BREADCRUMBS_RICH_SNIPPETS_RDFA) { // Add link options for RDFa support. - $options['attributes'] = array('rel' => 'v:url', 'property' => 'v:title'); + $options['attributes'] = [ + 'property' => 'ListItem', + 'typeof' => 'WebPage', + ]; $options['absolute'] = TRUE; // Set correct properties for RDFa support. - $elem_property = ' typeof="v:Breadcrumb"'; - $root_property = ' xmlns:v="http://rdf.data-vocabulary.org/#"'; + $elem_property = ' property="itemListElement" typeof="ListItem"'; + $root_property = ' vocab="http://schema.org/" typeof="BreadcrumbList"'; } elseif ($snippet == PATH_BREADCRUMBS_RICH_SNIPPETS_MICRODATA) { // Add link options for microdata support. - $options['attributes'] = array('itemprop' => 'url'); + $options['attributes'] = array('itemprop' => 'item'); $options['absolute'] = TRUE; // Set correct properties for microdata support. - $elem_property = ' itemscope itemtype="http://data-vocabulary.org/Breadcrumb"'; - $elem_tag = 'div'; + $elem_property = ' itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"'; + $elem_tag = variable_get('path_breadcrumbs_item_element_tag', 'li'); + + $root_property = ' itemscope itemtype="http://schema.org/BreadcrumbList"'; // Add style that will display breadcrumbs wrapped in
inline. drupal_add_css(drupal_get_path('module', 'path_breadcrumbs') . '/css/path_breadcrumbs.css'); @@ -425,10 +430,16 @@ // Get breadcrumb title from a link like "title". $title = trim(strip_tags($breadcrumb)); + $meta = ''; // Wrap title in additional element for microdata support. if ($snippet == PATH_BREADCRUMBS_RICH_SNIPPETS_MICRODATA) { - $title = '' . $title . ''; + $title = '' . $title . ''; + $meta .= ''; + } + elseif ($snippet == PATH_BREADCRUMBS_RICH_SNIPPETS_RDFA) { + $title = '' . $title . ''; + $meta .= ''; } // Support title attribute. @@ -448,12 +459,15 @@ $new_breadcrumb = !empty($href) ? l($title, $href, $options) : $title; // Replace old breadcrumb link with a new one. - $breadcrumbs[$key] = '<' . $elem_tag . ' class="' . implode(' ', $classes) . '"' . $elem_property . '>' . $new_breadcrumb . ''; + $breadcrumbs[$key] = '<' . $elem_tag . ' class="' . implode(' ', $classes) . '"' . $elem_property . '>' . $new_breadcrumb . $meta . ''; } // Get breadcrumb delimiter and wrap it into for customization. - $delimiter = check_plain(variable_get('path_breadcrumbs_delimiter', 'ยป')); - $delimiter = '' . trim($delimiter) . ''; + $render_delimiter = variable_get('path_breadcrumbs_render_delimiter', FALSE); + $delimiter = variable_get('path_breadcrumbs_delimiter', ""); + if ($render_delimiter !== FALSE) { + $delimiter = '' . trim($delimiter) . ''; + } $classes = array('breadcrumb'); @@ -469,8 +483,15 @@ $classes[] = 'contextual-links-region'; } + $crumbs_amount = variable_get('path_breadcrumbs_display_amount', FALSE); + if ($crumbs_amount) { + $classes[] = 'breadcrumbs-amount-' . count($breadcrumbs); + } + + $html_wrapper_element = variable_get('path_breadcrumbs_list_element_tag', 'ol'); + // Build final version of breadcrumb's HTML output. - $output .= '
' . $prefix . implode(" $delimiter ", $breadcrumbs) . '
'; + $output .= '<' . $html_wrapper_element . ' class="' . implode(' ', $classes) . '"' . $root_property . '>' . $prefix . implode(" $delimiter ", $breadcrumbs) . ''; return $output; }