diff --git a/config/install/pathauto.pattern.localgov_services_hierarchy.yml b/config/install/pathauto.pattern.localgov_services_hierarchy.yml index 1fe2699..9235eff 100644 --- a/config/install/pathauto.pattern.localgov_services_hierarchy.yml +++ b/config/install/pathauto.pattern.localgov_services_hierarchy.yml @@ -6,7 +6,7 @@ dependencies: id: localgov_services_hierarchy label: 'Services Hierarchy' type: 'canonical_entities:node' -pattern: '[node:localgov_services_parent:entity:url:relative]/[node:title]' +pattern: '[node:localgov_services_parent:entity:url:path]/[node:title]' selection_criteria: 9dd1b1bc-3678-4642-8568-86d6d27c3dfd: id: 'entity_bundle:node' diff --git a/localgov_services.post_update.php b/localgov_services.post_update.php new file mode 100644 index 0000000..a6a6dfa --- /dev/null +++ b/localgov_services.post_update.php @@ -0,0 +1,22 @@ +getPattern() == '[node:localgov_services_parent:entity:url:relative]/[node:title]' + ) { + $alias->setPattern('[node:localgov_services_parent:entity:url:path]/[node:title]'); + $alias->save(); + } +} diff --git a/modules/localgov_services_navigation/localgov_services_navigation.module b/modules/localgov_services_navigation/localgov_services_navigation.module index cab41e2..333b8ec 100644 --- a/modules/localgov_services_navigation/localgov_services_navigation.module +++ b/modules/localgov_services_navigation/localgov_services_navigation.module @@ -65,8 +65,8 @@ function localgov_services_navigation_pathauto_pattern_alter(PathautoPattern $pa // it has opt-ed in with the field add the (optional) parent to the path. $entity = reset($context['data']); assert($entity instanceof ContentEntityInterface); - if ($entity->hasField('localgov_services_parent') && strpos($pattern->getPattern(), '[node:localgov_services_parent:entity:url:relative]') === FALSE) { - $pattern->setPattern('[node:localgov_services_parent:entity:url:relative]/' . $pattern->getPattern()); + if ($entity->hasField('localgov_services_parent') && strpos($pattern->getPattern(), '[node:localgov_services_parent:entity:url:path]') === FALSE) { + $pattern->setPattern('[node:localgov_services_parent:entity:url:path]/' . $pattern->getPattern()); } } diff --git a/modules/localgov_services_status/config/optional/pathauto.pattern.localgov_service_status.yml b/modules/localgov_services_status/config/optional/pathauto.pattern.localgov_service_status.yml index 8b09ea6..fc624e6 100644 --- a/modules/localgov_services_status/config/optional/pathauto.pattern.localgov_service_status.yml +++ b/modules/localgov_services_status/config/optional/pathauto.pattern.localgov_service_status.yml @@ -6,7 +6,7 @@ dependencies: id: localgov_service_status label: 'Service Status Page' type: 'canonical_entities:node' -pattern: '[node:localgov_services_parent:entity:url:relative]/status/[node:title]' +pattern: '[node:localgov_services_parent:entity:url:path]/status/[node:title]' selection_criteria: fb899c5a-41f3-4482-9b7d-7f203c4290c4: id: 'entity_bundle:node' diff --git a/modules/localgov_services_status/localgov_services_status.post_update.php b/modules/localgov_services_status/localgov_services_status.post_update.php new file mode 100644 index 0000000..83b32c1 --- /dev/null +++ b/modules/localgov_services_status/localgov_services_status.post_update.php @@ -0,0 +1,22 @@ +getPattern() == '[node:localgov_services_parent:entity:url:relative]/status/[node:title]' + ) { + $alias->setPattern('[node:localgov_services_parent:entity:url:path]/status/[node:title]'); + $alias->save(); + } +}