You are here

function _custom_search_taxonomy_sort_form in Custom Search 7

Sort form.

1 call to _custom_search_taxonomy_sort_form()
custom_search_taxonomy_form_alter in modules/custom_search_taxonomy/custom_search_taxonomy.module
Implements hook_form_alter().

File

modules/custom_search_taxonomy/custom_search_taxonomy.module, line 241
Bring customizations to the default search box

Code

function _custom_search_taxonomy_sort_form($vocabularies, $delta = '') {
  if ($delta != '') {
    $delta = 'blocks_' . $delta . '_';
  }
  $form = array();
  $w = 1;
  foreach ($vocabularies as $voc) {
    $form['taxonomy' . $voc->vid] = array(
      '#title' => t('Taxonomy') . ': ' . check_plain($voc->name),
      '#weight' => variable_get('custom_search_' . $delta . 'taxonomy' . $voc->vid . '_weight', $w),
    );
    $form['taxonomy' . $voc->vid]['sort'] = array(
      '#type' => 'weight',
      '#default_value' => variable_get('custom_search_' . $delta . 'taxonomy' . $voc->vid . '_weight', $w),
      '#attributes' => array(
        'class' => array(
          'sort-select',
          'sort-select-' . variable_get('custom_search_' . $delta . 'taxonomy' . $voc->vid . '_region', 'block'),
        ),
      ),
    );
    $form['taxonomy' . $voc->vid]['region'] = array(
      '#type' => 'select',
      '#options' => array(
        'block' => t('Block'),
        'popup' => t('Popup'),
      ),
      '#default_value' => variable_get('custom_search_' . $delta . 'taxonomy' . $voc->vid . '_region', 'block'),
      '#attributes' => array(
        'class' => array(
          'region-select',
          'region-select-' . variable_get('custom_search_' . $delta . 'taxonomy' . $voc->vid . '_region', 'block'),
        ),
      ),
    );
    $w++;
  }
  return $form;
}