Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Fieldable Path

Security covered Maintenance fixes only 397 sites

This module provides a field type that stores an entity's URL alias. This allows headless applications to filter entities by their path, enabling dynamic routing based on human-readable URLs. It also integrates with Pathauto for alias generation and includes an action to bulk copy existing paths to the new field.

The module contains a field type which provides 1:1 reflection of "path" property (defined in entities to determine their human-readable URL alias).

Why would I need "path" property as a field?

Some headless Drupal successors (like JSON API) do not provide a way to filter entities by "path" property due to technical limitations (See #2799909: [BUGFIX] Return the alias and allow filtering on it).

It means that if you'd want to implement a dynamic routing from your frontend application (something more human-readable than just /article/[id]) then your app has to know which entity to render when an end user hits /article/[path] page. So far the only way to achieve this is to filter entities by path stored as a field.

Usage

  1. Install the module as usual
  2. Add "Fieldable Path" field to your entity through "Manage fields" page
  3. Create or update any entity

Now you can do the following (assuming you've added the field to "article" node with name "field_path"):

GET http://{host}/jsonapi/node/article?filter[field_path][value]=/my-article

Note that Pathauto is supported, so you can get all power of Drupal to generate human-readable aliases for your frontend application.

What to do if your site already has some content?

The module includes an action which clones path property to the field in a bulk mode. To find it, go to the node / user list page, select necessary items and pick "Copy path to Fieldable Path field" in the action selection dropdown.

Drupal 9–10 · not 11

Ask your assistant about Fieldable Path

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • path Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Apr 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core PHP Release date
8.x-1.0 Stable 9–10 Apr 3, 2023