Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/handlers/views_handler_area_text.inc | ||
---|---|---|
12 | 12 |
*/ |
13 | 13 |
class views_handler_area_text extends views_handler_area { |
14 | 14 |
|
15 |
function option_definition() { |
|
15 |
/** |
|
16 |
* {@inheritdoc} |
|
17 |
*/ |
|
18 |
public function option_definition() { |
|
16 | 19 |
$options = parent::option_definition(); |
17 |
$options['content'] = array('default' => '', 'translatable' => TRUE, 'format_key' => 'format'); |
|
18 |
$options['format'] = array('default' => NULL); |
|
19 |
$options['tokenize'] = array('default' => FALSE, 'bool' => TRUE); |
|
20 |
$options['content'] = array( |
|
21 |
'default' => '', |
|
22 |
'translatable' => TRUE, |
|
23 |
'format_key' => 'format', |
|
24 |
); |
|
25 |
$options['format'] = array( |
|
26 |
'default' => NULL, |
|
27 |
); |
|
28 |
$options['tokenize'] = array( |
|
29 |
'default' => FALSE, |
|
30 |
'bool' => TRUE, |
|
31 |
); |
|
20 | 32 |
return $options; |
21 | 33 |
} |
22 | 34 |
|
23 |
function options_form(&$form, &$form_state) { |
|
35 |
/** |
|
36 |
* {@inheritdoc} |
|
37 |
*/ |
|
38 |
public function options_form(&$form, &$form_state) { |
|
24 | 39 |
parent::options_form($form, $form_state); |
25 | 40 |
|
26 | 41 |
$form['content'] = array( |
... | ... | |
31 | 46 |
'#wysiwyg' => FALSE, |
32 | 47 |
); |
33 | 48 |
|
34 |
// @TODO: Refactor token handling into a base class.
|
|
49 |
// @todo Refactor token handling into a base class.
|
|
35 | 50 |
$form['tokenize'] = array( |
36 | 51 |
'#type' => 'checkbox', |
37 | 52 |
'#title' => t('Use replacement tokens from the first row'), |
... | ... | |
44 | 59 |
$options[t('Fields')]["[$field]"] = $handler->ui_name(); |
45 | 60 |
} |
46 | 61 |
|
47 |
$count = 0; // This lets us prepare the key as we want it printed. |
|
62 |
$count = 0; |
|
63 |
// This lets us prepare the key as we want it printed. |
|
48 | 64 |
foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) { |
49 | 65 |
$options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->ui_name())); |
50 | 66 |
$options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->ui_name())); |
51 | 67 |
} |
52 | 68 |
|
53 | 69 |
if (!empty($options)) { |
54 |
$output = '<p>' . t('The following tokens are available. If you would like to have the characters \'[\' and \']\' please use the html entity codes \'%5B\' or \'%5D\' or they will get replaced with empty space.' . '</p>'); |
|
70 |
$output = '<p>' |
|
71 |
. t("The following tokens are available. If you would like to have the characters '[' and ']' please use the html entity codes '%5B' or '%5D' or they will get replaced with empty space.") |
|
72 |
. '</p>'; |
|
55 | 73 |
foreach (array_keys($options) as $type) { |
56 | 74 |
if (!empty($options[$type])) { |
57 | 75 |
$items = array(); |
... | ... | |
61 | 79 |
$output .= theme('item_list', |
62 | 80 |
array( |
63 | 81 |
'items' => $items, |
64 |
'type' => $type |
|
82 |
'type' => $type,
|
|
65 | 83 |
)); |
66 | 84 |
} |
67 | 85 |
} |
... | ... | |
82 | 100 |
} |
83 | 101 |
} |
84 | 102 |
|
85 |
function options_submit(&$form, &$form_state) { |
|
103 |
/** |
|
104 |
* {@inheritdoc} |
|
105 |
*/ |
|
106 |
public function options_submit(&$form, &$form_state) { |
|
86 | 107 |
$form_state['values']['options']['format'] = $form_state['values']['options']['content']['format']; |
87 | 108 |
$form_state['values']['options']['content'] = $form_state['values']['options']['content']['value']; |
88 | 109 |
parent::options_submit($form, $form_state); |
89 | 110 |
} |
90 | 111 |
|
91 |
function render($empty = FALSE) { |
|
112 |
/** |
|
113 |
* {@inheritdoc} |
|
114 |
*/ |
|
115 |
public function render($empty = FALSE) { |
|
92 | 116 |
$format = isset($this->options['format']) ? $this->options['format'] : filter_default_format(); |
93 | 117 |
if (!$empty || !empty($this->options['empty'])) { |
94 | 118 |
return $this->render_textarea($this->options['content'], $format); |
... | ... | |
99 | 123 |
/** |
100 | 124 |
* Render a text area, using the proper format. |
101 | 125 |
*/ |
102 |
function render_textarea($value, $format) { |
|
126 |
public function render_textarea($value, $format) {
|
|
103 | 127 |
if ($value) { |
104 | 128 |
if ($this->options['tokenize']) { |
105 | 129 |
$value = $this->view->style_plugin->tokenize_value($value, 0); |
... | ... | |
107 | 131 |
return check_markup($value, $format, '', FALSE); |
108 | 132 |
} |
109 | 133 |
} |
134 |
|
|
110 | 135 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules