Block visibility conditions with context not saved

Created on 28 January 2025, 3 months ago

Problem/Motivation

The block visibility configuration is not saved for conditions having a context with multiple matching context providers when not the default (first) provider is selected.

This is related to the condition plugins because adding a context definition directly to a custom block type and selecting the non-default context provider works a expected.

Steps to reproduce

There are multiple conditions with a context available like group types, webforms and maybe even node types. I had the issue with group types so I will use this as example.

  1. Install the group module and create two group types (I have multiple group types and do not know how the UI behaves with only one type).
  2. Install the group_finder module to have a second group context provider available.
  3. (optionally) Install the ctools module.
  4. Go to configuration of any block.
    1. For the "Group Types" condition select the "Group Finder provider.
    2. Do not select any of the group types.
    3. If you've installed ctools do the same for the "Group Type" condition (which is provided by ctools for all entity types).
    4. Save the configuration.
  5. (In a second window) go to admin/config/development/configuration/single/export and check whether the visibility condition has been exported correctly.
  6. Go to configuration of the same block again.
    1. For the "Group Types" condition select the "Group Finder provider.
    2. Now select at least one of the group types.
    3. If you've installed ctools do the same for the "Group Type" condition (which is provided by ctools for all entity types).
    4. Save the configuration.
  7. Repeat step 5.

In step 5 the context will not be exported, but in step 7 it will be exported correctly.

🐛 Bug report
Status

Active

Version

10.4

Component

plugin system

Created by

🇦🇹Austria mvonfrie

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

Comments & Activities

  • Issue created by @mvonfrie
  • 🇦🇹Austria mvonfrie

    Notes about issue metadata:

    • I've observed the issue with Drupal 10.4.1 and selected this as version. Feel free to change it to 11.x but keep backporting to 10.4.x in mind.
    • I'm not sure whether this is more related to the plugin system or the configuration system. Change the component if necessary.
  • 🇦🇹Austria mvonfrie

    Because the result is the same for the "Group Types" condition from the group module and the for "Group Type" condition provided by ctools for all entity types, the cause must be in core and not in the group module.

  • 🇳🇿New Zealand quietone

    Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies .

    Restoring template.

Production build 0.71.5 2024