Problem/Motivation
The Media Gallery module provides a custom entity for creating media galleries. However, it lacks out-of-the-box integration with the Pathauto module. This means that users cannot automatically
generate URL aliases for their media galleries based on predefined patterns, which is a common requirement for SEO and user-friendly URLs.
Steps to reproduce
- Install and enable the Media Gallery and Pathauto modules.
- Navigate to the Pathauto patterns page (
/admin/config/search/path/patterns). - Click "Add Pathauto pattern".
- In the "Pattern type" dropdown, try to find an option for Media Gallery.
- Expected result: An option for "Media Gallery" exists.
- Actual result: No option for "Media Gallery" is available.
Proposed resolution
To resolve this, we will create a new MediaGalleryAliasType plugin for Pathauto. This plugin will make the media_gallery entity type discoverable by Pathauto, allowing site
builders to define custom URL alias patterns for media galleries through the Pathauto user interface.
This change provides the necessary integration without imposing any default patterns, giving users full control over their URL aliasing strategy.
Remaining tasks
None.
User interface changes
The "Media Gallery" entity type will now be available as an option in the "Pattern type" dropdown on the Pathauto pattern creation page (/admin/config/search/path/patterns/add).
API changes
A new Pathauto alias type plugin is added: Drupal\media_gallery\Plugin\pathauto\AliasType\MediaGalleryAliasType.
Data model changes
None.
Issue fork media_gallery-3548023
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
circuitcipher commentedComment #5
ivnishI added a test
Comment #7
ivnish