You are here

function theme_og_context_configure_form in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og_context/og_context.admin.inc \theme_og_context_configure_form()

Returns HTML for a group context configuration form.

Parameters

$variables: An associative array containing:

  • form: A render element representing the form.

Related topics

1 theme call to theme_og_context_configure_form()
og_context_configure_form in og_context/og_context.admin.inc
Setting for language negotiation options

File

og_context/og_context.admin.inc, line 106
Administration functions for Group context module.

Code

function theme_og_context_configure_form($variables) {
  $form = $variables['form'];
  $output = '';
  $type = 'group_context';
  $rows = array();
  $title = '<label>' . $form[$type]['#title'] . '</label>';
  $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'),
    );
  }
  $variables = array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => "group_context-negotiation-providers-{$type}",
    ),
  );
  $table = theme('table', $variables);
  $table .= drupal_render_children($form[$type]);
  drupal_add_tabledrag("group_context-negotiation-providers-{$type}", 'order', 'sibling', "group_context-provider-weight-{$type}");
  $output .= '<div class="form-item">' . $title . $description . $table . '</div>';
  $output .= drupal_render_children($form);
  return $output;
}