Override the existing block display plugin

Created on 9 January 2024, 6 months ago
Updated 10 January 2024, 6 months ago

Problem/Motivation

Instead of adding a new type of display block, we could change the class of existing block displays with the new class. This way when you have an existing views block and add a contextual filter, you can allow this filter to be overridden. Now you would need to create a new block, configure it the same and add the contextual settings.

Proposed resolution

Remove the annotation from ViewsBlockOverride and use alter hook to change out the block display class.

function views_block_override_views_plugins_display_alter(array &$plugins) {
$plugins['block']['class'] = 'Drupal\\views_block_override\\Plugin\\views\display\ViewsBlockOverride';
}

Remaining tasks

- write the hook
- remove the annotation from the ViewsBlockOverride class (maybe relocate it ??)
- create an updb hook to change existing block override displays and reset the "views_block_override" id to "block".

User interface changes

none

API changes

none

Data model changes

"views_block_override" plugin id will become "block"

✨ Feature request
Status

Active

Version

1.2

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium kriboogh

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

Comments & Activities

  • Issue created by @kriboogh
  • First commit to issue fork.
Production build 0.69.0 2024