You are here

function hook_views_plugin_option_definition_alter in Views (for Drupal 7) 7.3

Alter existing plugin option definitions.

This can be used to edit default or add new option definitions to existing plugins. 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 plugin individually. However if your goal is to override many, or even all plugins, 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.

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

See also

views_object::option_definition()

hook_views_handler_option_definition_alter()

hook_form_alter()

Related topics

1 invocation of hook_views_plugin_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 750
Describe hooks provided by the Views module.

Code

function hook_views_plugin_option_definition_alter(&$options, $plugin) {

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