function template_preprocess_language_content_settings_table

Same name in other branches
  1. 9 core/modules/language/language.admin.inc \template_preprocess_language_content_settings_table()
  2. 8.9.x core/modules/language/language.admin.inc \template_preprocess_language_content_settings_table()
  3. 10 core/modules/language/language.admin.inc \template_preprocess_language_content_settings_table()

Prepares variables for language content settings table templates.

Default template: language-content-settings-table.html.twig.

Parameters

array $variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #bundle_label, #title.

File

core/modules/language/language.admin.inc, line 106

Code

function template_preprocess_language_content_settings_table(&$variables) {
    // Add a render element representing the bundle language settings table.
    $element = $variables['element'];
    $header = [
        [
            'data' => $element['#bundle_label'],
            'class' => [
                'bundle',
            ],
        ],
        [
            'data' => t('Configuration'),
            'class' => [
                'operations',
            ],
        ],
    ];
    $rows = [];
    foreach (Element::children($element) as $bundle) {
        $rows[$bundle] = [
            'data' => [
                [
                    'data' => [
                        '#prefix' => '<label>',
                        '#suffix' => '</label>',
                        '#plain_text' => $element[$bundle]['settings']['#label'],
                    ],
                    'class' => [
                        'bundle',
                    ],
                ],
                [
                    'data' => $element[$bundle]['settings'],
                    'class' => [
                        'operations',
                    ],
                ],
            ],
            'class' => [
                'bundle-settings',
            ],
        ];
    }
    $variables['title'] = $element['#title'];
    $variables['build'] = [
        '#header' => $header,
        '#rows' => $rows,
        '#type' => 'table',
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.