You are here

function theme_facetapi_sort_settings_table in Facet API 7.2

Same name and namespace in other branches
  1. 6.3 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 726
Admin page callbacks for the Facet API module.

Code

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

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

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