-
Notifications
You must be signed in to change notification settings - Fork 0
/
ccom_faq.module
40 lines (36 loc) · 929 Bytes
/
ccom_faq.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* @file
* Main ccom_faq module file.
*/
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_theme().
*/
function ccom_faq_theme($existing, $type, $theme, $path) {
return [
'faqfield_ccom_answer_text' => [
'variables' => [
'question' => NULL,
'answer' => NULL,
'answer_format' => NULL,
'delta' => NULL,
],
],
];
}
/**
* Prepares variables for the ccom answer text field formatter template.
*
* @param array $variables
* An associative array containing:
* - question: Question value.
* - answer: Answer value.
* - answer_format: Answer markup format.
* - delta: Delta of field element.
*/
function template_preprocess_faqfield_ccom_answer_text(array &$variables) {
$variables['answer'] = check_markup($variables['answer'], $variables['answer_format']);
}