Commit 40728ffa authored by Omkar Deshpande's avatar Omkar Deshpande Committed by Greg Boggs
Browse files

Issue #3285430 by omkar-pd, NikolaAt, Greg Boggs: Do not check for path, that...

Issue #3285430 by omkar-pd, NikolaAt, Greg Boggs: Do not check for path, that is duplicate of home page
parent 89a989ac
Loading
Loading
Loading
Loading
+3 −0
Changes for src/EasyBreadcrumbBuilder.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -876,6 +876,9 @@ class EasyBreadcrumbBuilder implements BreadcrumbBuilderInterface {

    // Find the system path by resolving aliases, language prefix, etc.
    $processed = $this->pathProcessor->processInbound($path, $request);
    if ($this->config->get(EasyBreadcrumbConstants::HOME_SEGMENT_VALIDATION_SKIP)) {
      unset($exclude[$this->siteConfig->get('page.front')]);
    }
    if (empty($processed) || !empty($exclude[$processed])) {

      // This resolves to the front page, which we already add.
+5 −0
Changes for src/EasyBreadcrumbConstants.php: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -66,6 +66,11 @@ class EasyBreadcrumbConstants {
   */
  const HOME_SEGMENT_KEEP = 'home_segment_keep';

  /**
   * Flag for skipping validation for links the same as home page one.
   */
  const HOME_SEGMENT_VALIDATION_SKIP = 'home_segment_validation_skip';

  /**
   * Flag for including or not the page's title as a segment.
   */
+7 −0
Changes for src/Form/EasyBreadcrumbGeneralSettingsForm.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -244,6 +244,13 @@ class EasyBreadcrumbGeneralSettingsForm extends ConfigFormBase {
      ],
    ];

    $details_advanced[EasyBreadcrumbConstants::HOME_SEGMENT_VALIDATION_SKIP] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Do not check for path, that is duplicate of home page.'),
      '#description' => $this->t('If checked, validation for similarity between the breadcrumb element and the home page, will be skipped.'),
      '#default_value' => $config->get(EasyBreadcrumbConstants::HOME_SEGMENT_VALIDATION_SKIP),
    ];

    $details_advanced[EasyBreadcrumbConstants::TITLE_SEGMENT_AS_LINK] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Make the current page title segment a link'),