Problem/Motivation

When using a view with a contextual filter on node ID, I witnessed different results of config being able to inject the context or not:

- Block Layout, placing the view block in a region: OK (native, unrelated to ui_patterns, tested for comparison)
- Block Layout, placing the view block in a slot: OK
- Layout Builder, placing the view block in a region: OK (native, unrelated to ui_patterns, tested for comparison)
- Layout Builder, placing the view block in a slot: OK
- Manage Display, placing the view block in a slot: KO
- Display Builder, placing the view block in a slot: KO
- Display Builder, placing the view block at root (but I guess regarding Display Builder structure there is no difference with previous case): KO

It is in app/core/lib/Drupal/Core/Block/BlockBase.php:

  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form = $this->traitBuildConfigurationForm($form, $form_state);

    // Add context mapping UI form elements.
    $contexts = $form_state->getTemporaryValue('gathered_contexts') ?: [];
    $form['context_mapping'] = $this->addContextAssignmentElement($this, $contexts);

    return $form;
  }

The contexts needs to have been injected in the form state for $this->addContextAssignmentElement to generate the form elements for context mapping.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

grimreaper created an issue. See original summary.

just_like_good_vibes’s picture

Assigned: Unassigned » just_like_good_vibes
Status: Active » Postponed