pathauto_update
The Pathauto Update module is an extension for the popular Pathauto module. It makes sure that path aliases are automatically regenerated when values behind the tokens change. For example, in case of a Pathauto pattern with the [node:menu-link:parents:join-path] token, the URL of any child nodes will automatically be updated when the URL of a parent node changes.
Features
When updating an entity with a path alias, all entities, configs and other path aliases that were used to build that alias are stored in the database. In the future, when one of those path aliases, entities or configs are updated, the path alias that depends on them will be automatically regenerated.
Dependencies are automatically determined based on the tokens used in the Pathauto pattern. When your Pathauto pattern uses supported tokens, dependencies will be automatically added based on those tokens. For example, if your pattern contains the [site:name] token, the aliases using this pattern will be regenerated when the site name is changed.
Support for more token types can be added by creating plugins with the @PatternTokenDependencyProvider annotation, defining the token type in the type parameter and implementing the PatternTokenDependencyProviderInterface interface.
Post-Installation
This module doesn't need any configuration. During its installation, the dependencies of any existing path aliases are collected. The dependencies of any future path aliases are automatically collected as well.
Additional Requirements
Path aliases are regenerated in a queue, so make sure your site is set up to automatically process queues, for example during cron runs or using the Drush Queue Run All module.
You can manually process the queues using the following Drush commands:
drush queue:run pathauto_update_path_alias_dependency_updater
drush queue:run pathauto_update_path_alias_updater
Similar projects
- This module is based on the code of the wmpathauto module, which is not available on Drupal.org.
- The pending #3016532: Pathauto token for node menu hierarchy not working after updating parent node Pathauto issue and the Alias Hierarchy module try to fix the same issue, but is limited to menu link tokens, while this module deals with any token creating a dependency on other entities or config.