Context are forced selected by default and can't be removed

Created on 8 May 2022, over 2 years ago
Updated 10 July 2024, 4 months ago

Problem/Motivation

hi
using this nice module since d7 but i D8 i am trying to use it in conjunction with the asset_injector β†’ module where visibility condition can be select.

But the problem here is that fields context are automatically selected for all Entity available on the site and in the filter there is no way to unselect

The only workaround now for those entity's field forced to be part of conditions is to use the "Value is" rules against the entity's ID (Example: tid for vocabulary, ID for Group(group module)) and activate the Negate
All this to mean a logic of : If field's value is "nothing"

πŸ› Bug report
Status

Active

Version

1.0

Component

User interface

Created by

πŸ‡§πŸ‡―Benin delacosta456

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

Merge Requests

Comments & Activities

Not all content is available!

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

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

    This bit me with Google Tag and Require login modules would love to find a fix for this as well.

  • πŸ‡ΊπŸ‡ΈUnited States loze Los Angeles

    I was hit by this too with google_tag.

    In this module context_entity_field_plugin_filter_condition_alter unsets the definitions for context_entity_field contexts when they are being displayed the block_ui and layout builder. However other modules using conditions have them displayed.
    There is a comment // Keep within the Context UI only. but obviously this is not sufficient.

    I see two possible solutions.

    1. Improve the check for keeping these conditions in the context UI only (which appears to be the intent of this module)
    or if we want to use these context plugins outside of the context module.
    2. possibly provide an "enabled" checkbox for each field context that would prevent the plugins config from being saved if its unchecked.

  • Status changed to Needs review 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States loze Los Angeles

    MR!5 is a simple fix does option 1 I propsed above.

    It excludes the context from any form other than the context UI.

    You will still need to go in and edit any configs manually that were effected by this bug (like google_tag) and remove the unwanted contexts. You will then be able to use the UI to edit the config moving forward.

  • Status changed to Needs work about 1 month ago
  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    I applied the patch from MR 5 but in my case it didn't solve the problem. The conditions appear in my CSS injector UI and they are pre-selected with the first field in the list.

    It excludes the plugins created by this module from any form other than the context UI.

    is not what's happening in my case.

    I'm on the 2.x branch, could that be the issue?

  • πŸ‡ΉπŸ‡­Thailand AlfTheCat

    This is causing a major issue for me, as selection rules on all my asset injectors are no longer functional.

    I can't uninstall the module because I can't disable the selection rules provided by this module.

    I get a WSOD if I try:

    The website encountered an unexpected error. Try again later.
    
    Drupal\Component\Plugin\Exception\PluginNotFoundException: The "entity_field:node" plugin does not exist.

    Any tips on how I can get rid of the module?

Production build 0.71.5 2024