Taxonomy term field condition

Created on 16 July 2019, over 5 years ago
Updated 27 May 2023, over 1 year ago

I noticed that this module only supports node fields.
I have created a patch so the module can also support taxonomy terms.
Drupal currently only supports this when the following patch is applied before applying my patch: https://www.drupal.org/files/issues/2019-04-12/term_route_context-299882... β†’

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands thomasdik

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States dww

    I needed exactly this. The patch in #4 didn't work with 8.x-1.4 for various reasons. The most serious being that the required annotation is now context_definitions not just context. Furthermore, the entity_type_id we most care about is taxonony_term not taxonomy_vocabulary. We also don't need to store vocabulary separately in config - that's what entity_bundle is already for.

    While I was digging into getting this working, I decided to refactor NodeField and TermField into a shared EntityFieldConditionBase.php.

    This is still a work-in-progress. There are a few @todo comments I've left in the code. It's not totally clean and perfect. But it's now working enough for the project I need, so I'm uploading patches here. 3068125-6.patch is the regular patch created with renames = copies in my ~/.gitconfig. However, composer-patches was having trouble installing that against 8.x-1.4 itself, so 3068125-6.full.patch are the identical changes but with git diff configured to not try to do "smart renames". This seems to apply more reliably, but is a larger patch to review.

    Curious what the maintainers think of this direction.

    Thanks!
    -Derek

    p.s. sorry for some of the scope-creep clean-up. But as I'm refactoring everything into a shared base class, it was hard to resist the urge to fix things as I went.

Production build 0.71.5 2024