Commit fbfaa3a4 authored by Dries's avatar Dries

- Issue #1877338 by plopesc: convert language admin form to new #type 'table'.

parent 5c7f2d7a
......@@ -19,17 +19,20 @@ function language_admin_overview_form($form, &$form_state) {
$form['languages'] = array(
'#languages' => $languages,
'#language_default' => $default,
'#tree' => TRUE,
'#type' => 'table',
'#header' => array(
t('Name'),
t('Default'),
t('Weight'),
t('Operations'),
),
'#theme' => 'language_admin_overview_form_table',
'#tabledrag' => array(
array('order', 'sibling', 'language-order-weight'),
),
);
foreach ($languages as $langcode => $language) {
$form['languages'][$langcode]['#attributes']['class'][] = 'draggable';
$form['languages'][$langcode]['#weight'] = $language->weight;
$title = check_plain($language->name);
$description = '';
......@@ -98,43 +101,6 @@ function language_admin_overview_form($form, &$form_state) {
return $form;
}
/**
* Returns HTML for the language overview form.
*
* @param $variables
* An associative array containing:
* - form: A render element representing the form.
*
* @ingroup themeable
*/
function theme_language_admin_overview_form_table($variables) {
$form = $variables['form'];
$rows = array();
foreach (element_children($form, TRUE) as $langcode) {
$element = &$form[$langcode];
$row = array(
'class' => array('draggable'),
);
foreach (element_children($element, TRUE) as $column) {
$cell = &$element[$column];
$row['data'][] = drupal_render($cell);
}
$rows[] = $row;
}
$output = theme('table', array(
'header' => $form['#header'],
'rows' => $rows,
'attributes' => array('id' => 'language-order'),
));
$output .= drupal_render_children($form);
drupal_add_tabledrag('language-order', 'order', 'sibling', 'language-order-weight');
return $output;
}
/**
* Process language overview form submissions, updating existing languages.
*/
......
......@@ -188,10 +188,6 @@ function language_permission() {
*/
function language_theme() {
return array(
'language_admin_overview_form_table' => array(
'render element' => 'form',
'file' => 'language.admin.inc',
),
'language_negotiation_configure_form' => array(
'render element' => 'form',
),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment