function template_preprocess_faqfield_definition_list_formatter in FAQ Field 8
Same name and namespace in other branches
- 2.0.x faqfield.module \template_preprocess_faqfield_definition_list_formatter()
Prepares variables for the definition list field formatter template.
Parameters
array $variables: An associative array containing:
- items: An array of objects with the following fields.
- question: Prefiltered question value by strip_tags.
- answer: Prefiltered answer value by field setting format.
- answer_format: Answer markup format.
File
- ./
faqfield.module, line 119 - Defines a field for frequently asked questions.
Code
function template_preprocess_faqfield_definition_list_formatter(array &$variables) {
foreach ($variables['items'] as &$item) {
$item['question'] = Markup::create(trim(strip_tags($item['question'])));
$item['answer'] = check_markup($item['answer'], $item['answer_format']);
unset($item);
}
}