You are here

function countries_filter_options_form in Countries 7.2

Same name and namespace in other branches
  1. 8 countries.fields.inc \countries_filter_options_form()

Wrapper for the filter form options that are shared with other fields.

1 call to countries_filter_options_form()
countries_field_settings_form in ./countries.fields.inc
Implements hook_field_settings_form().

File

./countries.fields.inc, line 416
All field related code.

Code

function countries_filter_options_form(&$form, $settings) {
  $form['enabled'] = array(
    '#type' => 'radios',
    '#title' => t('Country status'),
    '#default_value' => isset($settings['enabled']) ? $settings['enabled'] : COUNTRIES_ENABLED,
    '#options' => array(
      COUNTRIES_ALL => t('Both'),
      COUNTRIES_ENABLED => t('Enabled countries only'),
      COUNTRIES_DISABLED => t('Disabled countries only'),
    ),
  );
  $form['countries'] = array(
    '#type' => 'select',
    '#title' => t('Filter by country'),
    '#default_value' => isset($settings['countries']) ? $settings['countries'] : array(),
    '#options' => countries_get_countries('name'),
    '#description' => t('If no countries are selected, this filter will not be used.'),
    '#size' => 10,
    '#multiple' => TRUE,
  );
  $form['continents'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Filter by continent'),
    '#default_value' => isset($settings['continents']) ? $settings['continents'] : array(),
    '#options' => countries_get_continents(),
    '#description' => t('If no continents are selected, this filter will not be used.'),
    '#element_validate' => array(
      '_countries_checkbox_filter',
    ),
  );
}