Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/system/views_handler_field_file_uri.inc | ||
---|---|---|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
9 |
* Field handler to add rendering file paths as file URLs instead of as internal file URIs. |
|
9 |
* Field handler to add rendering file paths as file URLs instead of as internal |
|
10 |
* file URIs. |
|
10 | 11 |
*/ |
11 | 12 |
class views_handler_field_file_uri extends views_handler_field_file { |
12 |
function option_definition() { |
|
13 |
|
|
14 |
/** |
|
15 |
* {@inheritdoc} |
|
16 |
*/ |
|
17 |
public function option_definition() { |
|
13 | 18 |
$options = parent::option_definition(); |
14 | 19 |
$options['file_download_path'] = array('default' => FALSE, 'bool' => TRUE); |
15 | 20 |
return $options; |
16 | 21 |
} |
17 | 22 |
|
18 |
function options_form(&$form, &$form_state) { |
|
23 |
/** |
|
24 |
* {@inheritdoc} |
|
25 |
*/ |
|
26 |
public function options_form(&$form, &$form_state) { |
|
19 | 27 |
$form['file_download_path'] = array( |
20 | 28 |
'#title' => t('Display download path instead of file storage URI'), |
21 | 29 |
'#description' => t('This will provide the full download URL rather than the internal filestream address.'), |
... | ... | |
25 | 33 |
parent::options_form($form, $form_state); |
26 | 34 |
} |
27 | 35 |
|
28 |
function render($values) { |
|
36 |
/** |
|
37 |
* {@inheritdoc} |
|
38 |
*/ |
|
39 |
public function render($values) { |
|
29 | 40 |
$data = $values->{$this->field_alias}; |
30 | 41 |
if (!empty($this->options['file_download_path']) && $data !== NULL && $data !== '') { |
31 | 42 |
$data = file_create_url($data); |
32 | 43 |
} |
33 | 44 |
return $this->render_link($data, $values); |
34 | 45 |
} |
46 |
|
|
35 | 47 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules