You are here

function theme_isotope_sorter in Isotope (with Masonry and Packery) 7.2

Default theme implementation for the sorting list.

Parameters

array $vars: Variables for theming.

Return value

string Markup.

2 theme calls to theme_isotope_sorter()
isotope_example_theme_page in isotope_example/isotope_example.module
Page callback.
template_preprocess_isotope_views_sorter in isotope_views/isotope_views.theme.inc
Preprocess function for isotope sort blocks.

File

./isotope.module, line 550
Load the isotope library and provide configuration and theme options.

Code

function theme_isotope_sorter(array $vars) {
  $attributes['class'] = 'isotope-options sorts clearfix';
  if (!empty($vars['instance'])) {
    $attributes['data-instance-id'] = 'isotope-instance-' . $vars['instance'];
  }
  if (!empty($vars['original'])) {
    $vars['sorts'] = array(
      $vars['original'] => 'original-order',
    ) + $vars['sorts'];
  }
  foreach ($vars['sorts'] as $key => $value) {
    $sort = is_array($value) ? implode(',', $value) : $value;
    $label = empty($key) || is_numeric($key) ? $sort : $key;
    $items[] = l($label, '', array(
      'attributes' => array(
        'class' => 'sorterbutton',
        'data-sort-by' => $sort,
      ),
      'fragment' => 'sorter',
      'external' => TRUE,
      'html' => TRUE,
    ));
  }
  $return = array(
    '#theme' => 'item_list',
    '#items' => $items,
    '#type' => 'ul',
    '#title' => t('Sort By'),
    '#attributes' => $attributes,
  );
  return drupal_render($return);
}