Dynamic path aliases, pathauto patterns & automatic updating of aliases
Dynamic path aliases, pathauto patterns & automatic updating of
aliases
This package requires PHP 7.1 and Drupal 8 or higher. It can be
installed using Composer:
composer require wieni/wmpathauto
Sometimes when defining pathauto patterns, you’ll notice the token
system is just too limited. This module supports building patterns and
aliases in code using plugins with annotations, respectively@AliasBuilder
and @PatternBuilder
.
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.
There are multiple ways to define dependencies:
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 thetype
parameter and implementing thePatternTokenDependencyProviderInterface
interface.
Dependencies can also be added manually by creating plugins with the@EntityAliasDependencyProvider
annotation, implementing theEntityAliasDependencyProviderInterface
interface. Plugins with AliasBuilder
orPatternBuilder
annotations implementing the same interface are also
considered.
All notable changes to this project will be documented in the
CHANGELOG file.
If you discover any security-related issues, please email
security@wieni.be instead of using the issue
tracker.
Distributed under the MIT License. See the LICENSE file
for more information.