Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/plugins/views_plugin_argument_default_php.inc | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* Contains the php code argument default plugin.
|
|
5 |
* Definition of views_plugin_argument_default_php.
|
|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
... | ... | |
11 | 11 |
* @ingroup views_argument_default_plugins |
12 | 12 |
*/ |
13 | 13 |
class views_plugin_argument_default_php extends views_plugin_argument_default { |
14 |
function option_definition() { |
|
14 |
|
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
18 |
public function option_definition() { |
|
15 | 19 |
$options = parent::option_definition(); |
16 | 20 |
$options['code'] = array('default' => ''); |
17 | 21 |
|
18 | 22 |
return $options; |
19 | 23 |
} |
20 | 24 |
|
21 |
function options_form(&$form, &$form_state) { |
|
25 |
/** |
|
26 |
* {@inheritdoc} |
|
27 |
*/ |
|
28 |
public function options_form(&$form, &$form_state) { |
|
22 | 29 |
parent::options_form($form, $form_state); |
23 | 30 |
$form['code'] = array( |
24 | 31 |
'#type' => 'textarea', |
... | ... | |
27 | 34 |
'#description' => t('Enter PHP code that returns a value to use for this filter. Do not use <?php ?>. You must return only a single value for just this filter. Some variables are available: the view object will be "$view". The argument handler will be "$argument", for example you may change the title used for substitutions for this argument by setting "argument->validated_title"".'), |
28 | 35 |
); |
29 | 36 |
|
30 |
// Only do this if using one simple standard form gadget |
|
37 |
// Only do this if using one simple standard form gadget.
|
|
31 | 38 |
$this->check_access($form, 'code'); |
32 | 39 |
} |
33 | 40 |
|
34 |
function convert_options(&$options) { |
|
41 |
/** |
|
42 |
* {@inheritdoc} |
|
43 |
*/ |
|
44 |
public function convert_options(&$options) { |
|
35 | 45 |
if (!isset($options['code']) && isset($this->argument->options['default_argument_php'])) { |
36 | 46 |
$options['code'] = $this->argument->options['default_argument_php']; |
37 | 47 |
} |
... | ... | |
41 | 51 |
* Only let users with PHP block visibility permissions set/modify this |
42 | 52 |
* default plugin. |
43 | 53 |
*/ |
44 |
function access() { |
|
54 |
public function access() {
|
|
45 | 55 |
return user_access('use PHP for settings'); |
46 | 56 |
} |
47 | 57 |
|
48 |
function get_argument() { |
|
58 |
/** |
|
59 |
* {@inheritdoc} |
|
60 |
*/ |
|
61 |
public function get_argument() { |
|
49 | 62 |
// set up variables to make it easier to reference during the argument. |
50 | 63 |
$view = &$this->view; |
51 | 64 |
$argument = &$this->argument; |
... | ... | |
54 | 67 |
ob_end_clean(); |
55 | 68 |
return $result; |
56 | 69 |
} |
70 |
|
|
57 | 71 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules