function geshifield_formatter_default in GeSHi Filter for syntax highlighting 8
Same name and namespace in other branches
- 8.2 geshifield/geshifield.module \geshifield_formatter_default()
Format the field.
This function get the sorcecode and language and format it using geshi.
Parameters
array $variables: Variables disponible for theme.
Return value
string The HTML to show the code formated with geshi.
1 string reference to 'geshifield_formatter_default'
- geshifield_theme in geshifield/
geshifield.module - Implements hook_theme().
File
- geshifield/
geshifield.module, line 35 - Defines a CCK field for source code with GeSHi syntax highlighting.
Code
function geshifield_formatter_default(array $variables) {
$language = $variables['geshifield']['#language'];
$sourcecode = $variables['geshifield']['#sourcecode'];
$output = '';
module_load_include('inc', 'geshifilter', 'geshifilter.pages');
if ($sourcecode) {
$output .= GeshiFilterProcess::geshiProcess($sourcecode, $language);
}
$elements = [];
$elements[] = [
'#markup' => $output,
];
return $output;
}