function theme_language_negotiation_configure_form

Returns HTML for the language negotiation configuration form.

Parameters

$variables: An associative array containing:

  • form: A render element representing the form.

Related topics

1 theme call to theme_language_negotiation_configure_form()
language_negotiation_configure_form in drupal/core/modules/language/language.admin.inc
Builds the configuration form for language negotiation.

File

drupal/core/modules/language/language.admin.inc, line 477
Administration functions for language.module.

Code

function theme_language_negotiation_configure_form($variables) {
  $form = $variables['form'];
  $output = '';
  foreach ($form['#language_types'] as $type) {
    $rows = array();
    $title = '<h4 class="label">' . $form[$type]['#title'] . '</h4>';
    $description = '<div class="description">' . $form[$type]['#description'] . '</div>';
    foreach ($form[$type]['title'] as $id => $element) {

      // Do not take form control structures.
      if (is_array($element) && element_child($id)) {
        $row = array(
          'data' => array(
            '<strong>' . drupal_render($form[$type]['title'][$id]) . '</strong>',
            drupal_render($form[$type]['description'][$id]),
            drupal_render($form[$type]['enabled'][$id]),
            drupal_render($form[$type]['weight'][$id]),
          ),
          'class' => array(
            'draggable',
          ),
        );
        if ($form[$type]['#show_operations']) {
          $row['data'][] = drupal_render($form[$type]['operation'][$id]);
        }
        $rows[] = $row;
      }
    }
    $header = array(
      array(
        'data' => t('Detection method'),
      ),
      array(
        'data' => t('Description'),
      ),
      array(
        'data' => t('Enabled'),
      ),
      array(
        'data' => t('Weight'),
      ),
    );

    // If there is at least one operation enabled show the operation column.
    if ($form[$type]['#show_operations']) {
      $header[] = array(
        'data' => t('Operations'),
      );
    }
    $build = array(
      '#theme' => 'table',
      '#header' => $header,
      '#rows' => $rows,
      '#attributes' => array(
        'id' => "language-negotiation-methods-{$type}",
      ),
    );
    $table = drupal_render($build);
    $table .= drupal_render_children($form[$type]);
    drupal_add_tabledrag("language-negotiation-methods-{$type}", 'order', 'sibling', "language-method-weight-{$type}");
    $output .= '<div class="form-item">' . $title . $description . $table . '</div>';
  }
  $output .= drupal_render_children($form);
  return $output;
}