I get a small number of support requests in the Easy Breadcrumb queue related to Bootstraps Breadcrumbs causing trouble for folks. Can we add a checkbox to disable the breadcrumbs for Bootstrap so that Bootstrap can work with other modules that extend breadcrumbs?

One of the support threads can be found here: https://www.drupal.org/node/2908915.

~G

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Greg Boggs created an issue. See original summary.

markhalliwell’s picture

Version: 8.x-4.x-dev » 8.x-3.x-dev
Category: Feature request » Support request
Status: Active » Closed (works as designed)
Issue tags: -breadcrumbs

These aren't "Drupal Bootstrap" breadcrumbs, they're just normal breadcrumbs with only a few enhancements (to alter the items in the breadcrumb array, e.g. appending/prepending/removing certain items).

Ultimately, these items are just Render Arrays or MarkupInterface objects that are rendered into the proper Bootstrap markup.

The "enhancements" provided by this base theme can easily be disabled by overriding the plugin in a sub-theme and not calling the parent methods. Obviously if one wishes to use a module such as Easy Breadcrumb, then they need to adjust their sub-theme accordingly.

Not every module/theme is going to work "out-of-the-box" with every other single module/theme.

The responsibility lies to the developer of the site to determine which modules/themes are compatible and to fix or provide custom code (as needed) when competing functionality like this is desired.

This is called site-building.

---

Create the following file in your sub-theme and replace all instances of THEMENAME
with the lowercase machine name of your sub-theme:

./THEMENAME/src/Plugin/Preprocess/Breadcrumb.php


namespace Drupal\THEMENAME\Plugin\Preprocess;

use Drupal\bootstrap\Plugin\Preprocess\Breadcrumb as BootstrapBreadcrumb;
use Drupal\bootstrap\Utility\Variables;

/**
 * Pre-processes variables for the "breadcrumb" theme hook.
 *
 * @ingroup plugins_preprocess
 *
 * @BootstrapPreprocess("breadcrumb")
 */
class Breadcrumb extends BootstrapBreadcrumb {

  /**
   * {@inheritdoc}
   */
  public function preprocessVariables(Variables $variables) {
    // Intentionally left blank to disable base theme's alterations.
  }

}
Greg Boggs’s picture

Thanks for the template Mark! That's just what I needed. Super good. I'll go ahead and include an option in easy breadcrumb for folks who aren't comfortable with programming their theme.

~G

markhalliwell’s picture

This is a preprocess hook (as a Bootstrap base theme based OO plugin), not a template.

Even if the base theme were to search module namespaces, it would immediately be overridden by the base theme due to how the theme system works.

Theme preprocess functions are always executed after module preprocess functions.

Historically, a module could implement a theme registry alter so it could modify preprocess functions so theirs could run after. However, this has always been considered bad practice (modules shouldn't be in the theming business).

Given that this base theme's implementation is an OO based plugin (discovered by the base theme itself http://cgit.drupalcode.org/bootstrap/tree/src/Plugin/PluginManager.php#n58), only sub-themes can override the base theme's implementation.

Simply put: this cannot be implemented in a module, only a sub-theme.

markhalliwell’s picture

It's also worth noting the following, from #2912611: how to completely disable bootstrap breadcrumb?, which implies there's actually nothing wrong with the module nor this project:

sorry, bootstrap works fine with easy breadcrumb. i had a configuration mistake.

Greg Boggs’s picture

Thanks for the additional details Mark. I appreciate it. Thanks for rocking it. I'll do some testing and see if I can write some documentation for the new folks.

~G

Greg Boggs’s picture

As long as folks don't use, "Show current page title at end" with Easy Breadcrumb also adding the current page title, then the two play nicely together. Screen shot attached.

tonytheferg’s picture

@ Greg Boggs, I am unable to find the check boxes in the easy breadcrumbs UI from your screenshot?