Browse Source

PR recommendations; clarify max-depth config

pull/873/head
Seth Shaw 3 years ago
parent
commit
e1428bb13a
  1. 4
      modules/islandora_breadcrumbs/src/Form/IslandoraBreadcrumbsSettingsForm.php
  2. 1
      modules/islandora_breadcrumbs/src/IslandoraBreadcrumbBuilder.php

4
modules/islandora_breadcrumbs/src/Form/IslandoraBreadcrumbsSettingsForm.php

@ -45,8 +45,8 @@ class IslandoraBreadcrumbsSettingsForm extends ConfigFormBase {
'#default_value' => $config->get('maxDepth'), '#default_value' => $config->get('maxDepth'),
'#min' => -1, '#min' => -1,
'#step' => 1, '#step' => 1,
'#title' => $this->t('Maximum number of breadcrumbs'), '#title' => $this->t('Maximum number of ancestor breadcrumbs'),
'#description' => $this->t("Stop adding parent references to the breadrumbs at this number of items. The default value, '-1' disables this feature."), '#description' => $this->t("Stops adding ancestor references when the chain reaches this number. The count does not include the current node when enabled. The default value, '-1' disables this feature."),
]; ];
$form['includeSelf'] = [ $form['includeSelf'] = [

1
modules/islandora_breadcrumbs/src/IslandoraBreadcrumbBuilder.php

@ -83,6 +83,7 @@ class IslandoraBreadcrumbBuilder implements BreadcrumbBuilderInterface {
$nid = $route_match->getRawParameters()->get('node'); $nid = $route_match->getRawParameters()->get('node');
$node = $this->nodeStorage->load($nid); $node = $this->nodeStorage->load($nid);
$breadcrumb = new Breadcrumb(); $breadcrumb = new Breadcrumb();
$breadcrumb->addCacheableDependency($this->config);
$breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>')); $breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '<front>'));
$chain = array_reverse($this->utils->findAncestors($node, $this->config->get('referenceFields'), $this->config->get('maxDepth'))); $chain = array_reverse($this->utils->findAncestors($node, $this->config->get('referenceFields'), $this->config->get('maxDepth')));

Loading…
Cancel
Save