5 * Contains the {{ plugin_name }} argument default plugin.
7 * @DCG This file needs to be referenced from {{ machine_name }}.info using files[] directive.
13 class views_plugin_argument_{{ plugin_machine_name }} extends views_plugin_argument_default {
18 public function option_definition() {
19 $options = parent::option_definition();
20 $options['example_option'] = array('default' => 15);
27 public function options_form(&$form, &$form_state) {
28 $form['example_option'] = array(
29 '#type' => 'textfield',
30 '#title' => t('Some example option.'),
31 '#default_value' => $this->options['example_option'],
38 public function options_validate(&$form, &$form_state) {
39 if ($form_state['values']['options']['argument_default']['{{ plugin_machine_name }}']['example_option'] == 10) {
40 form_error($form['example_option'], t('The value is not correct.'));
47 public function options_submit(&$form, &$form_state, &$options) {
48 $options['example_option'] = $form_state['values']['options']['argument_default']['{{ plugin_machine_name }}']['example_option'];
54 public function get_argument() {
57 // Here is the place where you should create a default argument for the
58 // contextual filter. The source of this argument depends on your needs.
59 // For example, you can extract the value from the URL or fetch it from
60 // some fields of the current viewed entity.
61 // For now lets use example option as an argument.
62 $argument = $this->options['example_option'];