page_title should be render_element

Created on 2 October 2023, about 1 year ago
Updated 19 October 2023, about 1 year ago

Problem/Motivation

Although in theory page-title.html.twig(https://api.drupal.org/api/drupal/core%21modules%21system%21templates%21...) supports title_attributes, title_prefix and title_suffix, this is not the case in the render array i.e for example i can't add class to the H1 html tag and i think this should be possible.

Steps to reproduce

Try to add class to the page_title render element with a render array:

$build = [
  '#type' => 'page_title',
  '#title' => "Some page title",
  '#title_attributes' => [
      'class' => [
        'header-title',
      ],
    ]
];

Proposed resolution

I think we should use

'render element' => 'element',

for the page_title render element like the following:

    'page_title' => [
      'render element' => 'element',
    ],

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component
Theme 

Last updated about 20 hours ago

Created by

🇭🇺Hungary mibfire

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

Comments & Activities

Production build 0.71.5 2024