function template_preprocess_views_ui_style_plugin_table
template_preprocess_views_ui_style_plugin_table(&$variables)
Prepares variables for style plugin table templates.
Default template: views-ui-style-plugin-table.html.twig.
Parameters
array $variables: An associative array containing:
- form: A render element representing the form.
File
- core/modules/views_ui/views_ui.theme.inc, line 371
- Preprocessors and theme functions for the Views UI.
Code
function template_preprocess_views_ui_style_plugin_table(&$variables) { $form = $variables['form']; $header = array( t('Field'), t('Column'), t('Align'), t('Separator'), array( 'data' => t('Sortable'), 'align' => 'center', ), array( 'data' => t('Default order'), 'align' => 'center', ), array( 'data' => t('Default sort'), 'align' => 'center', ), array( 'data' => t('Hide empty column'), 'align' => 'center', ), array( 'data' => t('Responsive'), 'align' => 'center', ), ); $rows = array(); foreach (Element::children($form['columns']) as $id) { $row = array(); $row[]['data'] = $form['info'][$id]['name']; $row[]['data'] = $form['columns'][$id]; $row[]['data'] = $form['info'][$id]['align']; $row[]['data'] = $form['info'][$id]['separator']; if (!empty($form['info'][$id]['sortable'])) { $row[] = array( 'data' => $form['info'][$id]['sortable'], 'align' => 'center', ); $row[] = array( 'data' => $form['info'][$id]['default_sort_order'], 'align' => 'center', ); $row[] = array( 'data' => $form['default'][$id], 'align' => 'center', ); } else { $row[] = ''; $row[] = ''; $row[] = ''; } $row[] = array( 'data' => $form['info'][$id]['empty_column'], 'align' => 'center', ); $row[] = array( 'data' => $form['info'][$id]['responsive'], 'align' => 'center', ); $rows[] = $row; } // Add the special 'None' row. $rows[] = array(array('data' => t('None'), 'colspan' => 6), array('align' => 'center', 'data' => $form['default'][-1]), array('colspan' => 2)); // Unset elements from the form array that are used to build the table so that // they are not rendered twice. unset($form['default']); unset($form['info']); unset($form['columns']); $variables['table'] = array( '#type' => 'table', '#theme' => 'table__views_ui_style_plugin_table', '#header' => $header, '#rows' => $rows, ); $variables['form'] = $form; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!views_ui!views_ui.theme.inc/function/template_preprocess_views_ui_style_plugin_table/8.1.x