You are here

public function views_handler_filter::option_definition in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 handlers/views_handler_filter.inc \views_handler_filter::option_definition()
  2. 6.2 handlers/views_handler_filter.inc \views_handler_filter::option_definition()

Information about options for all kinds of purposes will be held here.

@code 'option_name' => array(

  • 'default' => default value,
  • 'translatable' => (optional) TRUE/FALSE (wrap in t() on export if true),
  • 'contains' => (optional) array of items this contains, with its own defaults, etc. If contains is set, the default will be ignored and assumed to be array().
  • 'bool' => (optional) TRUE/FALSE Is the value a boolean value. This will change the export format to TRUE/FALSE instead of 1/0.
  • 'export' => (optional) FALSE or a callback for special export handling if necessary.
  • 'unpack_translatable' => (optional) callback for special handling for translating data within the option, if necessary.

),

Return value

array Returns the options of this handler/plugin.

Overrides views_handler::option_definition

See also

views_object::export_option()

views_object::export_option_always()

views_object::unpack_translatable()

7 calls to views_handler_filter::option_definition()
views_handler_filter_boolean_operator::option_definition in handlers/views_handler_filter_boolean_operator.inc
Information about options for all kinds of purposes will be held here.
views_handler_filter_fields_compare::option_definition in handlers/views_handler_filter_fields_compare.inc
Information about options for all kinds of purposes will be held here.
views_handler_filter_in_operator::option_definition in handlers/views_handler_filter_in_operator.inc
Information about options for all kinds of purposes will be held here.
views_handler_filter_node_tnid::option_definition in modules/translation/views_handler_filter_node_tnid.inc
Information about options for all kinds of purposes will be held here.
views_handler_filter_numeric::option_definition in handlers/views_handler_filter_numeric.inc
Information about options for all kinds of purposes will be held here.

... See full list

7 methods override views_handler_filter::option_definition()
views_handler_filter_boolean_operator::option_definition in handlers/views_handler_filter_boolean_operator.inc
Information about options for all kinds of purposes will be held here.
views_handler_filter_fields_compare::option_definition in handlers/views_handler_filter_fields_compare.inc
Information about options for all kinds of purposes will be held here.
views_handler_filter_in_operator::option_definition in handlers/views_handler_filter_in_operator.inc
Information about options for all kinds of purposes will be held here.
views_handler_filter_node_tnid::option_definition in modules/translation/views_handler_filter_node_tnid.inc
Information about options for all kinds of purposes will be held here.
views_handler_filter_numeric::option_definition in handlers/views_handler_filter_numeric.inc
Information about options for all kinds of purposes will be held here.

... See full list

File

handlers/views_handler_filter.inc, line 124
Definitions of views_handler_filter and views_handler_filter_broken.

Class

views_handler_filter
Base class for filters.

Code

public function option_definition() {
  $options = parent::option_definition();
  $options['operator'] = array(
    'default' => '=',
  );
  $options['value'] = array(
    'default' => '',
  );
  $options['group'] = array(
    'default' => '1',
  );
  $options['exposed'] = array(
    'default' => FALSE,
    'bool' => TRUE,
  );
  $options['expose'] = array(
    'contains' => array(
      'operator_id' => array(
        'default' => FALSE,
      ),
      'label' => array(
        'default' => '',
        'translatable' => TRUE,
      ),
      'description' => array(
        'default' => '',
        'translatable' => TRUE,
      ),
      'use_operator' => array(
        'default' => FALSE,
        'bool' => TRUE,
      ),
      'operator_label' => array(
        'default' => '',
        'translatable' => TRUE,
      ),
      'operator' => array(
        'default' => '',
      ),
      'limit_operators' => array(
        'default' => FALSE,
        'bool' => TRUE,
      ),
      'available_operators' => array(
        'default' => array(),
      ),
      'identifier' => array(
        'default' => '',
      ),
      'required' => array(
        'default' => FALSE,
        'bool' => TRUE,
      ),
      'remember' => array(
        'default' => FALSE,
        'bool' => TRUE,
      ),
      'multiple' => array(
        'default' => FALSE,
        'bool' => TRUE,
      ),
      'remember_roles' => array(
        'default' => array(
          DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID,
        ),
      ),
    ),
  );

  // A group is a combination of a filter, an operator and a value
  // operating like a single filter.
  // Users can choose from a select box which group they want to apply.
  // Views will filter the view according to the defined values.
  // Because it acts as a standard filter, we have to define
  // an identifier and other settings like the widget and the label.
  // This settings are saved in another array to allow users to switch
  // between a normal filter and a group of filters with a single click.
  $options['is_grouped'] = array(
    'default' => FALSE,
    'bool' => TRUE,
  );
  $options['group_info'] = array(
    'contains' => array(
      'label' => array(
        'default' => '',
        'translatable' => TRUE,
      ),
      'description' => array(
        'default' => '',
        'translatable' => TRUE,
      ),
      'identifier' => array(
        'default' => '',
      ),
      'optional' => array(
        'default' => TRUE,
        'bool' => TRUE,
      ),
      'widget' => array(
        'default' => 'select',
      ),
      'multiple' => array(
        'default' => FALSE,
        'bool' => TRUE,
      ),
      'remember' => array(
        'default' => 0,
      ),
      'default_group' => array(
        'default' => 'All',
      ),
      'default_group_multiple' => array(
        'default' => array(),
      ),
      'group_items' => array(
        'default' => array(),
      ),
    ),
  );
  return $options;
}