You are here

function global_filter_block_configure in Views Global Filter 6

Same name and namespace in other branches
  1. 8 global_filter.blocks.inc \global_filter_block_configure()
  2. 7 global_filter.blocks.inc \global_filter_block_configure()
1 call to global_filter_block_configure()
global_filter_block in ./global_filter.blocks.inc
Implements hook_block().

File

./global_filter.blocks.inc, line 50
global_filter.block.inc

Code

function global_filter_block_configure($delta) {
  $form = array();
  $form['global_filter'] = array(
    '#type' => 'fieldset',
    '#title' => 'Global filter settings',
    '#collapsible' => FALSE,
    '#attributes' => array(
      'id' => 'edit-global-filter',
    ),
  );
  $form['global_filter'][$delta . '_uses_view'] = array(
    '#type' => 'radios',
    '#title' => t('Select whether this filter is to be populated by a node field or by a view'),
    '#options' => array(
      FALSE => t('field (or node property)'),
      TRUE => t('view'),
    ),
    '#default_value' => variable_get($delta . '_uses_view', TRUE),
  );

  // Add javascript to reveal the appropriate field or view selector depending
  // on the radio button selected.
  $path = drupal_get_path('module', 'global_filter');
  drupal_add_js($path . '/global_filter.js');
  $field_options = array_merge(array(
    '' => t('- None -'),
  ), global_filter_get_node_properties());
  asort($field_options);
  $form['global_filter'][$delta . '_field'] = array(
    '#type' => 'select',
    '#title' => t('Choose the field to be used as a global filter'),
    '#default_value' => variable_get($delta . '_field', ''),
    '#options' => $field_options,
    '#description' => t('The property or field employed to populate the drop-down or text box used to filter views or other page elements on.'),
    '#attributes' => array(
      'id' => 'global-filter-selector-field',
    ),
  );
  $view_options = array_merge(array(
    '' => t('- None -'),
  ), global_filter_get_view_names());
  asort($view_options);
  $form['global_filter'][$delta . '_view'] = array(
    '#type' => 'select',
    '#title' => t('Choose the view to be used as a global filter'),
    '#default_value' => variable_get($delta . '_view', ''),
    '#options' => $view_options,
    '#description' => t('The view employed to populate the drop-down used to filter views or other page elements on.'),
    '#attributes' => array(
      'id' => 'global-filter-selector-view',
    ),
  );
  $form['global_filter'][$delta . '_option_all_text'] = array(
    '#type' => 'textfield',
    '#title' => t('Text to appear as the "all" option, if the filter is rendered as a drop-down'),
    '#default_value' => variable_get($delta . '_option_all_text', ''),
    '#description' => t('If left blank "<strong>@all</strong>" will be used. Enter <em>&lt;none&gt;</em> to omit the "all" option.', array(
      '@all' => GLOBAL_FILTER_DEF_OPTION_ALL_TEXT,
    )),
  );
  return $form;
}