diff --git a/includes/base.inc b/includes/base.inc index 2d2ceb5..e3f52c2 100644 --- a/includes/base.inc +++ b/includes/base.inc @@ -55,6 +55,16 @@ class views_object { function option_definition() { return array(); } /** + * Collect this handler's option definition and alter them, ready for use. + */ + function altered_option_definition() { + $definition = $this->option_definition(); + $type = !empty($this->is_plugin) ? 'plugin' : 'handler'; + drupal_alter("views_{$type}_option_definition", $definition, $this); + return $definition; + } + + /** * Views handlers use a special construct function so that we can more * easily construct them with variable arguments. */ @@ -74,7 +84,7 @@ class views_object { * feature that will likely disappear at some point. */ function set_default_options() { - $this->_set_option_defaults($this->options, $this->option_definition()); + $this->_set_option_defaults($this->options, $this->altered_option_definition()); // Retained for complex defaults plus backward compatibility. $this->options($this->options); @@ -105,7 +115,7 @@ class views_object { } if (!isset($definition)) { - $definition = $this->option_definition(); + $definition = $this->altered_option_definition(); } if (!empty($this->view)) { @@ -202,7 +212,7 @@ class views_object { function export_options($indent, $prefix) { $output = ''; - foreach ($this->option_definition() as $option => $definition) { + foreach ($this->altered_option_definition() as $option => $definition) { $output .= $this->export_option($indent, $prefix, $this->options, $option, $definition, array()); } @@ -274,7 +284,7 @@ class views_object { * Unpacks each handler to store translatable texts. */ function unpack_translatables(&$translatable, $parents = array()) { - foreach ($this->option_definition() as $option => $definition) { + foreach ($this->altered_option_definition() as $option => $definition) { $this->unpack_translatable($translatable, $this->options, $option, $definition, $parents, array()); } }