Change record status: 
Project: 
Introduced in branch: 
8.4.x
Introduced in version: 
9.4.0-alpha1
Description: 

The html_tag render element now supports render array nesting, similar to how arrays are nested under container elements.

Before

Previously the html_tag only accepted markup in its #value property, which meant you had to pass a string or pre-render markup.

$rect = [
  '#type' => 'html_tag',
  '#tag' => 'rect',
  '#attributes' => [
    'width' => 50,
    'height' => 50,
    'style' => 'fill:rgb(0,0,255)',
  ],
];
$svg = [
  '#type' => 'html_tag',
  '#tag' => 'svg',
  '#value' => render($rect)
];

After

Now you can nest render arrays under an html_tag, allowing more complex structures.

$svg = [
  '#type' => 'html_tag',
  '#tag' => 'svg',
  [
    '#type' => 'html_tag',
    '#tag' => 'rect',
    '#attributes' => [
      'width' => 50,
      'height' => 50,
      'style' => 'fill:rgb(0,0,255)',
    ],
  ],
];
Impacts: 
Module developers
Themers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done

Comments

Pol’s picture