Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
id: localgov_step_by_step_page
label: 'Step by step page'
type: 'canonical_entities:node'
pattern: '[node:localgov_step_parent:entity:url:relative]/[node:title]'
pattern: '[node:localgov_step_parent:entity:url:path]/[node:title]'
selection_criteria:
e8541e26-53e0-4b3e-92eb-e13703ad3772:
id: 'entity_bundle:node'
Expand Down
22 changes: 22 additions & 0 deletions localgov_step_by_step.post_update.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* @file
* Post update functions for LocalGov Step By Step.
*/

use Drupal\pathauto\Entity\PathautoPattern;
use Drupal\pathauto\PathautoPatternInterface;

/**
* Update pathauto patterns to avoid inclusion of subdirectory, language, etc.
*/
function localgov_step_by_step_post_update_pathauto_parent(): void {
$alias = PathautoPattern::load('localgov_step_by_step_page');
if ($alias instanceof PathautoPatternInterface &&
$alias->getPattern() == '[node:localgov_step_parent:entity:url:relative]/[node:title]'
) {
$alias->setPattern('[node:localgov_step_parent:entity:url:path]/[node:title]');
$alias->save();
}
}
Loading