You are here

function theme_search_api_admin_fields_table in Search API 7

Returns HTML for a field list form.

Parameters

array $variables: An associative array containing:

  • element: A render element representing the form.

Return value

string The HTML for a field list form.

File

./search_api.admin.inc, line 2132
Administration page callbacks for the Search API module.

Code

function theme_search_api_admin_fields_table($variables) {
  $form = $variables['element'];
  $header = array(
    t('Field'),
    t('Machine name'),
    t('Indexed'),
    t('Type'),
    t('Boost'),
  );
  $rows = array();
  foreach (element_children($form['fields']) as $name) {
    $row = array();
    foreach (element_children($form['fields'][$name]) as $field) {
      if ($cell = render($form['fields'][$name][$field])) {
        $row[] = $cell;
      }
    }
    if (empty($form['fields'][$name]['description']['#value'])) {
      $rows[] = _search_api_deep_copy($row);
    }
    else {
      $rows[] = array(
        'data' => $row,
        'title' => strip_tags($form['fields'][$name]['description']['#value']),
      );
    }
  }
  $note = isset($form['note']) ? $form['note'] : '';
  $submit = $form['submit'];
  $additional = isset($form['additional']) ? $form['additional'] : FALSE;
  unset($form['note'], $form['submit'], $form['additional']);
  $output = drupal_render_children($form);
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $output .= render($note);
  $output .= render($submit);
  if ($additional) {
    $output .= render($additional);
  }
  return $output;
}