Browse Source

Merge pull request #795 from seth-shaw-unlv/issue-1367

Issue 1367: Loosen Islandora Breadcrumbs applies
pull/797/head
Jordan Dukart 4 years ago committed by GitHub
parent
commit
1be998fd20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/islandora_breadcrumbs/src/IslandoraBreadcrumbBuilder.php
  2. 12
      modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php

2
modules/islandora_breadcrumbs/src/IslandoraBreadcrumbBuilder.php

@ -54,7 +54,7 @@ class IslandoraBreadcrumbBuilder implements BreadcrumbBuilderInterface {
$nid = $attributes->getRawParameters()->get('node');
if (!empty($nid)) {
$node = $this->nodeStorage->load($nid);
return (!empty($node) && $node->hasField($this->config->get('referenceField')) && !$node->get($this->config->get('referenceField'))->isEmpty());
return (!empty($node) && $node->hasField($this->config->get('referenceField')));
}
}

12
modules/islandora_breadcrumbs/tests/src/Functional/BreadcrumbsTest.php

@ -114,6 +114,18 @@ class BreadcrumbsTest extends IslandoraFunctionalTestBase {
// We should still escape it and have the same trail as before.
$this->assertBreadcrumb($this->nodeD->toUrl()->toString(), $breadcrumbs);
// Delete 'A', removing it from the chain.
$this->nodeA->delete();
// The new breadcrumb chain without 'A'.
$breadcrumbs = [
Url::fromRoute('<front>')->toString() => 'Home',
$this->nodeB->toUrl()->toString() => $this->nodeB->label(),
$this->nodeC->toUrl()->toString() => $this->nodeC->label(),
];
$this->assertBreadcrumb($this->nodeD->toUrl()->toString(), $breadcrumbs);
}
}

Loading…
Cancel
Save