You are here

function hook_views_handler_option_definition_alter in Views (for Drupal 7) 7.3

Alter existing handler option definitions.

This can be used to edit default or add new option definitions to existing handlers. The reason for doing this is that only overriding the relevent form with hook_form_alter() is insufficent because submitted form values will be ignored if they haven't been declared as an available option.

An alternative approach you could also take is to extend each handler individually. However if your goal is to override many, or even all handlers, this results in a lot of additional code and files. This makes it a lot more troublesome to maintain the codebase, as well as interoperability with other modules.

Parameters

array $options: The option definitions to be altered.

$handler: A views object of the handler where the default options are defined.

See also

views_handler::option_definition()

hook_views_plugin_option_definition_alter()

hook_form_alter()

Related topics

1 invocation of hook_views_handler_option_definition_alter()
views_object::altered_option_definition in includes/base.inc
Collect this handler's option definition and alter them, ready for use.

File

./views.api.php, line 778
Describe hooks provided by the Views module.

Code

function hook_views_handler_option_definition_alter(&$options, $handler) {

  // Add a new option definition.
  $options['option_name'] = array(
    'default' => '',
  );
}