You are here

function template_preprocess_faqfield_jquery_accordion_formatter in FAQ Field 2.0.x

Same name and namespace in other branches
  1. 8 faqfield.module \template_preprocess_faqfield_jquery_accordion_formatter()

Prepares variables for the jQuery accordion 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.
  • id: Id to wrap the accordion markup in.

File

./faqfield.module, line 160
Defines a field for frequently asked questions.

Code

function template_preprocess_faqfield_jquery_accordion_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);
  }
}