template_preprocess_language_content_settings_table

template_preprocess_language_content_settings_table(&$variables)

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
Administration functions for language.module.

Code

function template_preprocess_language_content_settings_table(&$variables) {
  // Add a render element representing the bundle language settings table.
  $element = $variables['element'];

  $header = array(
    array(
      'data' => $element['#bundle_label'],
      'class' => array('bundle'),
    ),
    array(
      'data' => t('Configuration'),
      'class' => array('operations'),
    ),
  );

  $rows = array();
  foreach (Element::children($element) as $bundle) {
    $rows[$bundle] = array(
      'data' => array(
        array(
          'data' => array(
            '#prefix' => '<label>',
            '#suffix' => '</label>',
            '#plain_text' => $element[$bundle]['settings']['#label'],
          ),
          'class' => array('bundle'),
        ),
        array(
          'data' => $element[$bundle]['settings'],
          'class' => array('operations'),
        ),
      ),
      'class' => array('bundle-settings'),
    );
  }

  $variables['title'] = $element['#title'];
  $variables['build'] = array(
    '#header' => $header,
    '#rows' => $rows,
    '#type' => 'table',
  );
}
doc_Drupal
2016-10-29 09:46:44
Comments
Leave a Comment

Please login to continue.