Same name and namespace in other branches
- 8.x-1.x src/EasyBreadcrumbBuilder.php \Drupal\easy_breadcrumb\EasyBreadcrumbBuilder::linksAreEqual()
Compares two breadcrumb links for equality.
Parameters
\Drupal\Core\Link $link1: The first link.
\Drupal\Core\Link $link2: The second link.
Return value
bool TRUE if equal, FALSE otherwise.
1 call to EasyBreadcrumbBuilder::linksAreEqual()
- EasyBreadcrumbBuilder::removeRepeatedSegments in src/
EasyBreadcrumbBuilder.php - Remove duplicate repeated segments.
File
-
src/
EasyBreadcrumbBuilder.php, line 835
Class
- EasyBreadcrumbBuilder
- Primary implementation for the Easy Breadcrumb builder.
Namespace
Drupal\easy_breadcrumbCode
protected function linksAreEqual(Link $link1, Link $link2) {
$links_equal = TRUE;
if ($link1->getText() instanceof TranslatableMarkup) {
$link_one_text = (string) $link1->getText();
}
else {
$link_one_text = $link1->getText();
}
if ($link2->getText() instanceof TranslatableMarkup) {
$link_two_text = (string) $link2->getText();
}
else {
$link_two_text = $link2->getText();
}
if ($link_one_text != $link_two_text) {
$links_equal = FALSE;
}
$validate_urls = $this->config
->get(EasyBreadcrumbConstants::REMOVE_REPEATED_SEGMENTS_TEXT_ONLY);
if (!$validate_urls && $link1->getUrl()
->getInternalPath() != $link2->getUrl()
->getInternalPath()) {
$links_equal = FALSE;
}
return $links_equal;
}