5 * Definition of views_plugin_argument_default.
9 * @defgroup views_argument_default_plugins Views argument default plugins
11 * Allow specialized methods of filling in arguments when they aren't provided.
13 * @see hook_views_plugins()
17 * The fixed argument default handler; also used as the base.
19 class views_plugin_argument_default extends views_plugin {
21 * Return the default argument.
23 * This needs to be overridden by every default argument handler to properly do what is needed.
25 function get_argument() { }
28 * Initialize this plugin with the view and the argument
31 function init(&$view, &$argument, $options) {
33 $this->argument = &$argument;
35 $this->convert_options($options);
36 $this->unpack_options($this->options, $options);
40 * Retrieve the options when this is a new access
43 function option_definition() { return array(); }
46 * Provide the default form for setting options.
48 function options_form(&$form, &$form_state) { }
51 * Provide the default form form for validating options
53 function options_validate(&$form, &$form_state) { }
56 * Provide the default form form for submitting options
58 function options_submit(&$form, &$form_state, &$options = array()) { }
61 * Determine if the administrator has the privileges to use this
64 function access() { return TRUE; }
67 * If we don't have access to the form but are showing it anyway, ensure that
68 * the form is safe and cannot be changed from user input.
70 * This is only called by child objects if specified in the options_form(),
71 * so it will not always be used.
73 function check_access(&$form, $option_name) {
74 if (!$this->access()) {
75 $form[$option_name]['#disabled'] = TRUE;
76 $form[$option_name]['#value'] = $form[$this->option_name]['#default_value'];
77 $form[$option_name]['#description'] .= ' <strong>' . t('Note: you do not have permission to modify this. If you change the default filter type, this setting will be lost and you will NOT be able to get it back.') . '</strong>';
82 * Convert options from the older style.
84 * In Views 3, the method of storing default argument options has changed
85 * and each plugin now gets its own silo. This method can be used to
86 * move arguments from the old style to the new style. See
87 * views_plugin_argument_default_fixed for a good example of this method.
89 function convert_options(&$options) { }