Changing the widget context doesn't work

Created on 9 June 2025, 25 days ago

Problem/Motivation

When the widget context is modified, it is not reflected in the Entity Browser Context Widget, each time the context is saved a new key is generated . The Entity Browser Context Widget uses the first generated key, so subsequent changes are not found, as they are stored with other keys.

Steps to reproduce

Steps:
1. Add a new filter in a hook_field_widget_form_alter in the widget context. For example: $element['entity_browser']['#widget_context']['filter'] = $value;
2. Create a contextual filter in the entity browser view, indicating that the default value is "Entity Browser Context" and with the "Context key" equal to the filter added in the previous step (in this case, "filter"). The applied contextual filter doesn't work.

Proposed resolution

Have a unique key for each widget context stored. Use the session ID, for example.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.13

Component

Widget plugins

Created by

🇪🇸Spain pascuperbla

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

Comments & Activities

Production build 0.71.5 2024