Révision 96a203dd
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/ctools/plugins/contexts/string.inc | ||
---|---|---|
14 | 14 |
'title' => t('String'), |
15 | 15 |
'description' => t('A context that is just a string.'), |
16 | 16 |
'context' => 'ctools_context_create_string', |
17 |
'edit form' => 'ctools_context_string_settings_form', |
|
18 |
'defaults' => '', |
|
17 | 19 |
'keyword' => 'string', |
18 | 20 |
'no ui' => FALSE, |
19 | 21 |
'context name' => 'string', |
... | ... | |
44 | 46 |
} |
45 | 47 |
|
46 | 48 |
if ($data !== FALSE ) { |
47 |
$context->data = $data; |
|
49 |
// Support the array storage from the settings form but also handle direct input from arguments. |
|
50 |
$context->data = is_array($data) ? $data['string'] : $data; |
|
48 | 51 |
$context->title = ($conf) ? check_plain($data['identifier']) : check_plain($data); |
49 | 52 |
return $context; |
50 | 53 |
} |
... | ... | |
62 | 65 |
} |
63 | 66 |
} |
64 | 67 |
|
68 |
/** |
|
69 |
* String settings form. |
|
70 |
*/ |
|
71 |
function ctools_context_string_settings_form($form, &$form_state) { |
|
72 |
$conf = &$form_state['conf']; |
|
73 |
|
|
74 |
$form['string'] = array( |
|
75 |
'#title' => t('Enter the string'), |
|
76 |
'#type' => 'textfield', |
|
77 |
'#maxlength' => 512, |
|
78 |
'#weight' => -10, |
|
79 |
'#default_value' => $conf['string'], |
|
80 |
); |
|
81 |
|
|
82 |
return $form; |
|
83 |
} |
|
84 |
|
|
85 |
function ctools_context_string_settings_form_submit($form, &$form_state) { |
|
86 |
$form_state['conf']['string'] = $form_state['values']['string']; |
|
87 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules