Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/plugins/views_plugin_argument_validate_php.inc | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* Contains the php code argument validator plugin.
|
|
5 |
* Definition of views_plugin_argument_validate_php.
|
|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
... | ... | |
11 | 11 |
* @ingroup views_argument_validate_plugins |
12 | 12 |
*/ |
13 | 13 |
class views_plugin_argument_validate_php extends views_plugin_argument_validate { |
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', |
... | ... | |
34 | 41 |
* Only let users with PHP block visibility permissions set/modify this |
35 | 42 |
* validate plugin. |
36 | 43 |
*/ |
37 |
function access() { |
|
44 |
public function access() {
|
|
38 | 45 |
return user_access('use PHP for settings'); |
39 | 46 |
} |
40 | 47 |
|
41 |
function convert_options(&$options) { |
|
48 |
/** |
|
49 |
* {@inheritdoc} |
|
50 |
*/ |
|
51 |
public function convert_options(&$options) { |
|
42 | 52 |
if (!isset($options['code']) && isset($this->argument->options['validate_argument_php'])) { |
43 | 53 |
$options['code'] = $this->argument->options['validate_argument_php']; |
44 | 54 |
} |
45 | 55 |
} |
46 | 56 |
|
47 |
function validate_argument($argument) { |
|
57 |
/** |
|
58 |
* {@inheritdoc} |
|
59 |
*/ |
|
60 |
public function validate_argument($argument) { |
|
48 | 61 |
// set up variables to make it easier to reference during the argument. |
49 | 62 |
$view = &$this->view; |
50 | 63 |
$handler = &$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