Browse Source

PR recommendations; clarify max-depth config

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

2
modules/islandora_breadcrumbs/islandora_breadcrumbs.links.menu.yml

@ -2,4 +2,4 @@ system.islandora_breadcrumbs_settings:
title: 'Breadcrumbs Settings'
parent: system.admin_config_islandora
route_name: system.islandora_breadcrumbs_settings
description: 'Configure Islandora breadcrumb settings'
description: 'Configure Islandora breadcrumb settings'

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

@ -45,8 +45,8 @@ class IslandoraBreadcrumbsSettingsForm extends ConfigFormBase {
'#default_value' => $config->get('maxDepth'),
'#min' => -1,
'#step' => 1,
'#title' => $this->t('Maximum number of breadcrumbs'),
'#description' => $this->t("Stop adding parent references to the breadrumbs at this number of items. The default value, '-1' disables this feature."),
'#title' => $this->t('Maximum number of ancestor breadcrumbs'),
'#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'] = [

1
modules/islandora_breadcrumbs/src/IslandoraBreadcrumbBuilder.php

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

Loading…
Cancel
Save