You are here

function theme_facetapi_sort_settings_table in Facet API 6.3

Same name and namespace in other branches
  1. 7.2 facetapi.admin.inc \theme_facetapi_sort_settings_table()
  2. 7 facetapi.admin.inc \theme_facetapi_sort_settings_table()

Returns facet sort order table.

Parameters

$variables: An associative array containing:

  • element: A render element representing the form.
1 theme call to theme_facetapi_sort_settings_table()
facetapi_facet_display_form in ./facetapi.admin.inc
Form constructor for the facet display settings form.

File

./facetapi.admin.inc, line 694
Admin page callbacks for the Facet API module.

Code

function theme_facetapi_sort_settings_table($variables) {
  $output = '';

  // Gets variables for code readability.
  $searcher = $variables['#facetapi']['adapter']
    ->getSearcher();
  $header = array(
    'active' => array(),
    'label' => array(
      'data' => t('Sort'),
    ),
    'order' => array(
      'data' => t('Order'),
    ),
    'weight' => array(
      'data' => t('Weight'),
      'sort' => 'asc',
    ),
  );

  // Builds field options.
  $rows = array();
  $sort_info = $variables['#facetapi']['sort_info'];
  foreach ($sort_info as $sort_name => $sort) {
    $rows[$sort_name] = array(
      'class' => 'draggable',
      'data' => array(
        drupal_render($variables['active_sorts'][$sort_name]),
        check_plain($sort['label']) . "<div class='description'>" . filter_xss($sort['description']) . '</div>',
        drupal_render($variables['sort_order'][$sort_name]),
        drupal_render($variables['sort_weight'][$sort_name]),
      ),
    );
  }
  drupal_add_tabledrag('facetapi-sort-settings', 'order', 'sibling', 'facetapi-sort-weight');

  //$output .= drupal_render_children($variables);
  $output .= theme('table', $header, $rows, array(
    'id' => 'facetapi-sort-settings',
  ));
  return $output;
}