You are here

function theme_search_autocomplete_form_configuration_fieldset in Search Autocomplete 7.2

Same name and namespace in other branches
  1. 6.2 search_autocomplete.form.configure.inc \theme_search_autocomplete_form_configuration_fieldset()

CALLBACK: Theme function for this treelist form

1 theme call to theme_search_autocomplete_form_configuration_fieldset()
search_autocomplete_form_configure in ./search_autocomplete.form.configure.inc
MENU CALLBACK: Define the form to configure the suggestions.

File

./search_autocomplete.form.configure.inc, line 226
Search Autocomplete Helper functions to retrive suggestions from database

Code

function theme_search_autocomplete_form_configuration_fieldset($variables) {
  $form = $variables['form'];
  $header = array(
    'Title',
    'Enabled',
    'Prefix of the item in suggestions',
    'Weight',
    'Operation',
  );
  $rows = array();

  // for each elements to anchor in the form
  foreach (element_children($form) as $key) {
    $element =& $form[$key];
    $element['sug_weight']['#attributes']['class'] = array(
      'weight-group',
    );
    $rows[] = array(
      'data' => array(
        drupal_render($element['sug_title']),
        drupal_render($element['sug_enabled']),
        drupal_render($element['sug_prefix']),
        drupal_render($element['sug_weight']),
        drupal_render($element['sug_edit']),
      ),
      'class' => array(
        'draggable',
      ),
    );
  }

  // Themize the table and render the form
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'draggable-table',
    ),
  ));
  $output .= drupal_render($form['submit']);
  $output .= drupal_render_children($form);
  drupal_add_tabledrag('draggable-table', 'order', 'sibling', 'weight-group');
  return $output;
}