function geshifield_textarea_process in GeSHi Filter for syntax highlighting 6
Same name and namespace in other branches
- 7 geshifield/geshifield.module \geshifield_textarea_process()
Process callback for geshifield_textarea widget.
1 string reference to 'geshifield_textarea_process'
- geshifield_elements in geshifield/
geshifield.module - Implementation of hook_elements().
File
- geshifield/
geshifield.module, line 143 - Defines a CCK field for source code with GeSHi syntax highlighting.
Code
function geshifield_textarea_process($element, $edit, &$form_state, $form) {
module_load_include('inc', 'geshifilter');
$defaults = $element['#value'];
$field = content_fields($element['#field_name'], $element['#type_name']);
$enabled_languages = _geshifilter_get_enabled_languages();
// @todo: also add "no highlighting" options.
$element['sourcecode'] = array(
'#type' => 'textarea',
'#title' => t('Source code'),
'#default_value' => isset($defaults['sourcecode']) ? $defaults['sourcecode'] : '',
'#required' => $element['#required'],
'#rows' => $field['widget']['rows'],
'#description' => filter_xss($field['widget']['description']),
);
$element['language'] = array(
'#type' => 'select',
'#title' => t('Syntax highlighting mode'),
'#default_value' => isset($defaults['language']) ? $defaults['language'] : '',
'#options' => $enabled_languages,
'#description' => t('Select the syntax highlighting mode to use for the source code.'),
);
return $element;
}