Make View blocks (block.settings.view_block:*) fully validatable

Created on 24 April 2025, 21 days ago

Problem/Motivation

πŸ“Œ Make Block config entities fully validatable Fixed made Block config entities fully validatable, and the settings for 2 block plugins:

  1. content blocks (block.settings.block_content:*:) (see block_content.schema.yml
  2. the search form block block.settings.search_form_block (see search.schema.yml)

Steps to reproduce

N/A

Proposed resolution

Also make

views_block:
  type: block_settings
  label: 'View block'
  mapping:
    views_label:
      type: label
      label: 'Title'
    items_per_page:
      type: string
      label: 'Items per block'

block.settings.views_block:*:
  type: views_block

fully validatable.

Confusingly:

  • views_label is made available by \Drupal\views\Plugin\Block\ViewsBlockBase::buildConfigurationForm()
  • items_per_page is made available by \Drupal\views\Plugin\views\display\Block::blockForm()

The two are brought together into a single form by a third method: \Drupal\views\Plugin\Block\ViewsBlock::blockForm()

So … this seems surprisingly simple? πŸ˜„ All the actual control over the block lives in the associated View entity, not in the Views Block's configuration! Lucky us: no need for an update path! πŸ˜„

Remaining tasks

  1. Add the missing config schema.
  2. Review.

User interface changes

None.

Introduced terminology

None.

API changes

None.

Data model changes

TBD

Release notes snippet

TBD

πŸ“Œ Task
Status

Active

Version

11.1 πŸ”₯

Component

views.module

Created by

πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
  • Contributed project blocker

    It denotes an issue that prevents porting of a contributed project to the stable version of Drupal due to missing APIs, regressions, and so on.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024