Customizable views area handlers ids

Created on 27 May 2025, about 1 month ago

Problem/Motivation

Currently, when adding an area plugin to a view's display (like say for example a "text_custom" type area), Views automatically generates a machine name, based on the type of area, suffixed by an incremented number, corresponding to the number of areas of the same type already in place.

This works fine, until you decide to customize the output of this display, through a custom template.
Then, when deciding how to print the variable containing those areas, (for example {{ footer }}), you might decide to split those areas (for example, using {{ footer.area_text_custom }} somewhere inside your markup, then {{ footer.area_text_custom_1 }} elsewhere).

If later on you need to delete any or all of those areas, and don't re-create them all, using the exact same order, you will break this template customization.

Proposed resolution

The solution would be to leave it up to the site builder, through the UI, to set a pre-determined area handler id.

Feature request
Status

Active

Version

11.0 🔥

Component

views.module

Created by

🇫🇷France arousseau

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

Merge Requests

Comments & Activities

  • Issue created by @arousseau
  • Pipeline finished with Failed
    about 1 month ago
    Total: 143s
    #507506
  • Pipeline finished with Failed
    about 1 month ago
    Total: 176s
    #507512
  • Pipeline finished with Failed
    about 1 month ago
    Total: 117s
    #507527
  • Pipeline finished with Success
    about 1 month ago
    Total: 427s
    #507563
  • 🇫🇷France arousseau

    I added a rough proof of concept which works ok.

    I had to add the Method Drupal\views\Plugin\views\area\AreaPluginBase::submitOptionsForm() has no return type specified. phpstan error to the list of ignored errors in core/.phpstan-baseline.php since \Drupal\views\Plugin\views\area\Entity already implements it and would break.

  • 🇳🇱Netherlands Lendude Amsterdam

    I would be against doing this in Drupal core, it adds more options to the Views UI which is already too full of options, and this feel very much like an edge case. If you need this in a project you can just add a custom area plugin that does this and use that, right? Just my feeling.

    Back to needs work for the tests.

  • 🇫🇷France prudloff Lille

    My rationale for adding this to core would be that almost every other machine name in Drupal can be customized from the UI.

Production build 0.71.5 2024