From f7d74a5be8501252d666bd183bf6186357f84127 Mon Sep 17 00:00:00 2001 From: ekes Date: Wed, 29 Oct 2025 17:20:08 +0100 Subject: [PATCH] Fixes prefixes (subdirectory, language) being included in parent path pattern for other instances. See https://github.com/localgovdrupal/localgov_services/issues/335#issuecomment-3461396195 --- .../pathauto.pattern.localgov_guides_page.yml | 2 +- localgov_guides.post_update.php | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 localgov_guides.post_update.php diff --git a/config/optional/pathauto.pattern.localgov_guides_page.yml b/config/optional/pathauto.pattern.localgov_guides_page.yml index 8a5636d..bfbf116 100644 --- a/config/optional/pathauto.pattern.localgov_guides_page.yml +++ b/config/optional/pathauto.pattern.localgov_guides_page.yml @@ -6,7 +6,7 @@ dependencies: id: localgov_guides_page label: 'Guide page' type: 'canonical_entities:node' -pattern: '[node:localgov_guides_parent:entity:url:relative]/[node:title]' +pattern: '[node:localgov_guides_parent:entity:url:path]/[node:title]' selection_criteria: 1ceaab92-3301-4e34-a8de-9dbcae184528: id: 'entity_bundle:node' diff --git a/localgov_guides.post_update.php b/localgov_guides.post_update.php new file mode 100644 index 0000000..6cf77a4 --- /dev/null +++ b/localgov_guides.post_update.php @@ -0,0 +1,22 @@ +getPattern() == '[node:localgov_guides_parent:entity:url:relative]/[node:title]' + ) { + $alias->setPattern('[node:localgov_guides_parent:entity:url:path]/[node:title]'); + $alias->save(); + } +}