Problem/Motivation

openagenda_preprocess_openagenda_agenda hook adds a /event suffix after the node URL:

// Set event local link.
$event['local_url'] = $node->toUrl()->toString() . '/event/' . $event['slug'];

Though, in the processInbound method of the OpenagendaPathProcessor class the /event suffix is automatically added for path aliased nodes:

if ($processed_candidate_path !== $candidate_path && preg_match('/^\/node\/(\d+)$/', $processed_candidate_path, $matches)) {
  // See if that node contains an OpenAgenda field.
  if ($this->entityTypeManager->getStorage('node')->load($matches[1])->hasField('field_openagenda')) {
    // Rewrite the path to point to the route to our event controller.
    $path = $processed_candidate_path . '/event/' . $subpath;
  }
}

So the /event suffix ends added twice in the processed event URL and display fails.

Steps to reproduce

Simply create an alias for a node with an openagenda field and check the events URLs.

Proposed resolution

Only add the /event suffix if the node URL is of the form /node/123.

Issue fork openagenda-3420259

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

  • mably committed c52ea819 on 3.0.x
    Issue #3420259 by mably: only add /event suffix to canonical node URLs
    
mably’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.