You are here

function theme_admin_language_languages_overview_form in Administration Language 7

Same name and namespace in other branches
  1. 6 admin_language.module \theme_admin_language_languages_overview_form()

Theme the language overview form.

This is just theme_locale_languages_overview_form() with support for the admin language radio buttons.

@todo: Compare with current version of this function.

File

./admin_language.module, line 571
Makes admin pages be displayed in the administrator's preferred language.

Code

function theme_admin_language_languages_overview_form($variables) {
  $form = $variables['form'];
  $default = language_default();
  foreach ($form['name'] as $key => $element) {
    if (is_array($element) && element_child($key)) {
      if ($key == $default->language) {
        $form['enabled'][$key]['#attributes']['disabled'] = 'disabled';
      }
      $rows[] = array(
        'data' => array(
          '<strong>' . drupal_render($form['name'][$key]) . '</strong>',
          drupal_render($form['native'][$key]),
          check_plain($key),
          drupal_render($form['direction'][$key]),
          array(
            'data' => drupal_render($form['enabled'][$key]),
            'align' => 'center',
          ),
          drupal_render($form['site_default'][$key]),
          drupal_render($form['admin_language'][$key]),
          drupal_render($form['weight'][$key]),
          l(t('edit'), 'admin/config/regional/language/edit/' . $key) . ($key != 'en' && $key != $default->language ? ' ' . l(t('delete'), 'admin/config/regional/language/delete/' . $key) : ''),
        ),
        'class' => array(
          'draggable',
        ),
      );
    }
  }
  $header = array(
    array(
      'data' => t('English name'),
    ),
    array(
      'data' => t('Native name'),
    ),
    array(
      'data' => t('Code'),
    ),
    array(
      'data' => t('Direction'),
    ),
    array(
      'data' => t('Enabled'),
    ),
    array(
      'data' => t('Default'),
    ),
    array(
      'data' => t('Admin'),
    ),
    array(
      'data' => t('Weight'),
    ),
    array(
      'data' => t('Operations'),
    ),
  );
  $variables = array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'language-order',
    ),
  );
  $output = theme('table', $variables);
  $output .= drupal_render_children($form);
  drupal_add_tabledrag('language-order', 'order', 'sibling', 'language-order-weight');
  return $output;
}