Arrays containing comments are not rendered correctly

Created on 15 August 2025, about 3 hours ago

For example, on system_page_attachments(), the following code is not correctly indented.

  $meta_default = [
    // Make sure the Content-Type comes first because the IE browser may be
    // vulnerable to XSS via encoding attacks from any content that comes
    // before this META tag, such as a TITLE tag.
'system_meta_content_type' => [
      '#tag' => 'meta',
      '#attributes' => [
        'charset' => 'utf-8',
      ],
      // Security: This always has to be output first.
'#weight' => -1000,
    ],
    // Show Drupal and the major version number in the META GENERATOR tag.
'system_meta_generator' => [
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => [
        'name' => 'Generator',
        'content' => 'Drupal ' . $version . ' (https://www.drupal.org)',
      ],
    ],
    // Attach default mobile meta tags for responsive design.
'MobileOptimized' => [
      '#tag' => 'meta',
      '#attributes' => [
        'name' => 'MobileOptimized',
        'content' => 'width',
      ],
    ],
    'HandheldFriendly' => [
      '#tag' => 'meta',
      '#attributes' => [
        'name' => 'HandheldFriendly',
        'content' => 'true',
      ],
    ],
    'viewport' => [
      '#tag' => 'meta',
      '#attributes' => [
        'name' => 'viewport',
        'content' => 'width=device-width, initial-scale=1.0',
      ],
    ],
  ];

The line after each comment should be indented four spaces more.

🐛 Bug report
Status

Active

Version

2.0

Component

User interface

Created by

🇮🇹Italy apaderno Brescia, 🇮🇹

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

Comments & Activities

Production build 0.71.5 2024