1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Definition of views_plugin_argument_default.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* @defgroup views_argument_default_plugins Views argument default plugins
|
10
|
* @{
|
11
|
* Allow specialized methods of filling in arguments when they aren't provided.
|
12
|
*
|
13
|
* @see hook_views_plugins()
|
14
|
*/
|
15
|
|
16
|
/**
|
17
|
* The fixed argument default handler; also used as the base.
|
18
|
*/
|
19
|
class views_plugin_argument_default extends views_plugin {
|
20
|
|
21
|
/**
|
22
|
* Return the default argument.
|
23
|
*
|
24
|
* This needs to be overridden by every default argument handler to properly
|
25
|
* do what is needed.
|
26
|
*/
|
27
|
public function get_argument() {
|
28
|
}
|
29
|
|
30
|
/**
|
31
|
* Initialize this plugin with the view and the argument it is linked to.
|
32
|
*/
|
33
|
public function init(&$view, &$argument, $options) {
|
34
|
$this->view = &$view;
|
35
|
$this->argument = &$argument;
|
36
|
|
37
|
$this->convert_options($options);
|
38
|
$this->unpack_options($this->options, $options);
|
39
|
}
|
40
|
|
41
|
/**
|
42
|
* Retrieve the options when this is a new access control plugin.
|
43
|
*/
|
44
|
public function option_definition() {
|
45
|
return array();
|
46
|
}
|
47
|
|
48
|
/**
|
49
|
* Provide the default form for setting options.
|
50
|
*/
|
51
|
public function options_form(&$form, &$form_state) {
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* Provide the default form form for validating options.
|
56
|
*/
|
57
|
public function options_validate(&$form, &$form_state) {
|
58
|
}
|
59
|
|
60
|
/**
|
61
|
* Provide the default form form for submitting options.
|
62
|
*/
|
63
|
public function options_submit(&$form, &$form_state, &$options = array()) {
|
64
|
}
|
65
|
|
66
|
/**
|
67
|
* Determine if the administrator has the privileges to use this plugin.
|
68
|
*/
|
69
|
public function access() {
|
70
|
return TRUE;
|
71
|
}
|
72
|
|
73
|
/**
|
74
|
* If we don't have access to the form but are showing it anyway, ensure that
|
75
|
* the form is safe and cannot be changed from user input.
|
76
|
*
|
77
|
* This is only called by child objects if specified in the options_form(),
|
78
|
* so it will not always be used.
|
79
|
*/
|
80
|
public function check_access(&$form, $option_name) {
|
81
|
if (!$this->access()) {
|
82
|
$form[$option_name]['#disabled'] = TRUE;
|
83
|
$form[$option_name]['#value'] = $form[$this->option_name]['#default_value'];
|
84
|
$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>';
|
85
|
}
|
86
|
}
|
87
|
|
88
|
/**
|
89
|
* Convert options from the older style.
|
90
|
*
|
91
|
* In Views 3, the method of storing default argument options has changed
|
92
|
* and each plugin now gets its own silo. This method can be used to
|
93
|
* move arguments from the old style to the new style. See
|
94
|
* views_plugin_argument_default_fixed for a good example of this method.
|
95
|
*/
|
96
|
public function convert_options(&$options) {
|
97
|
}
|
98
|
|
99
|
}
|
100
|
|
101
|
/**
|
102
|
* @}
|
103
|
*/
|