Block Context assignment form element rendered when only null option is available

Created on 8 December 2021, over 2 years ago
Updated 9 November 2023, 7 months ago

Problem/Motivation

The ContextAwarePluginAssignmentTrait::addContextAssignmentElement(), when it collects $options, can end up with empty options in certain circumstances. This ends up displaying an empty select list on the block form.

Steps to reproduce

Two examples where [view_mode: null] is only option:
1. Create views block with a contextual filter on a plain text field. Add the views block via layout builder and form shows an empty select list.
2. Create views block with a contextual filter on Taxonomy term: Name via a relationship to a term. Add the views block via layout builder and form shows an empty select list.

Proposed resolution

Filter out null $options in addContextAssignmentElement()

Remaining tasks

Create patch to adjust ContextAwarePluginAssignmentTrait::addContextAssignmentElement()

User interface changes

Does not create select list for contextual filters on block form on null options.

API changes

none

Data model changes

none

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
PluginΒ  β†’

Last updated about 14 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States seanpclark

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

Production build 0.69.0 2024