Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/system/views_handler_field_file_extension.inc | ||
---|---|---|
7 | 7 |
|
8 | 8 |
/** |
9 | 9 |
* Returns a pure file extension of the file, for example 'module'. |
10 |
* |
|
10 | 11 |
* @ingroup views_field_handlers |
11 | 12 |
*/ |
12 | 13 |
class views_handler_field_file_extension extends views_handler_field { |
14 |
|
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
13 | 18 |
public function option_definition() { |
14 | 19 |
$options = parent::option_definition(); |
15 | 20 |
$options['extension_detect_tar'] = array('default' => FALSE, 'bool' => TRUE); |
16 | 21 |
return $options; |
17 | 22 |
} |
18 | 23 |
|
24 |
/** |
|
25 |
* {@inheritdoc} |
|
26 |
*/ |
|
19 | 27 |
public function options_form(&$form, &$form_state) { |
20 | 28 |
parent::options_form($form, $form_state); |
21 | 29 |
$form['extension_detect_tar'] = array( |
... | ... | |
26 | 34 |
); |
27 | 35 |
} |
28 | 36 |
|
29 |
function render($values) { |
|
37 |
/** |
|
38 |
* {@inheritdoc} |
|
39 |
*/ |
|
40 |
public function render($values) { |
|
30 | 41 |
$value = $this->get_value($values); |
31 | 42 |
if (!$this->options['extension_detect_tar']) { |
32 | 43 |
if (preg_match('/\.([^\.]+)$/', $value, $match)) { |
... | ... | |
46 | 57 |
} |
47 | 58 |
} |
48 | 59 |
} |
60 |
|
|
49 | 61 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules