Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293561

Have Views' taxonomy term filters use UUIDs instead of entity IDs

$
0
0

Problem/Motivation

It is not reliable to deploy configuration of Views that reference taxonomy terms when the local site and production site are not exactly matching because they reference the Term ID (content) rather than the UUID. Creating a view which has a filter on a term from a node field should export to configuration with UUID filter values rather than taxonomy term entity IDs.

Steps to reproduce

  1. Create a term in a local site
  2. Content editor creates multiple a term in production in a different order than local
  3. Term IDs don't match but UUIDs would
  4. Since Term IDs don't match, the View is unexpectedly configure to filter by the wrong term.

Proposed resolution

Views configuration with filters on taxonomy terms should use the UUID of the entity chosen. On the front-end, keep everything using entity IDs. On the back-end (storage), store IDs as UUIDs, and convert them when passing between the front-end.

Remaining tasks

Needs work:

  1. #115: $view->calculateDependencies() is not returning the 'content' references

Tasks completed:

  1. Support viewing, editing and saving the filter form with text/autocomplete.
  2. Support viewing, editing and saving the filter form with select options.
  3. Ensure that views are displaying the correct results.
  4. Update existing schema: Ensure that views can be saved and re-read properly, with the same config.
  5. Migrate existing data: Add update hook to convert entity IDs in config to UUIDs.
  6. Fix test failures.

User interface changes

None

Introduced terminology

N/A

API changes

N/A

Data model changes

Views configuration will store references to taxonomy terms as UUIDs not IDs.

Release notes snippet

Change record added here: https://www.drupal.org/node/3464158

Original proposal

Add a checkbox to the filter configuration form to allow users to use the uuid of the term as the filter value rather than the tid.

As a stop-gap until this is implemented in core, I implemented it as a custom filter which extends the current taxonomy term id filter. This may help in determining which parts of the code need to be touched when implementing https://gist.github.com/acbramley/1127c4698a9ae86885e03716f47e3281


Viewing all articles
Browse latest Browse all 293561

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>