You are here

function theme_search_autocomplete_form_configuration_fieldset in Search Autocomplete 6.2

Same name and namespace in other branches
  1. 7.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 209
Search Autocomplete Helper functions to retrive suggestions from database

Code

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

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

    // Add a draggable class to every table row (<tr>)
    $rows[] = array(
      'data' => $row,
      'class' => 'draggable',
    );
  }

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