-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtawk_to.module
60 lines (55 loc) · 1.1 KB
/
tawk_to.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* @file
* Contains main module code.
*/
declare (strict_types = 1);
/**
* Implements hook_help().
*
* @see hook_help()
*/
function tawk_to_help(string $route_name): string {
switch ($route_name) {
case 'help.page.tawk_to':
$info = t('
<h2><a href="http://tawk.to">Tawk.to</a> widget for Drupal.</h2>
<p>Tawk.to widget cutomization, using this module you can select widget which will be used on specific site pages.</p>
');
return (string) $info;
}
return '';
}
/**
* Implements hook_page_bottom().
*
* Hook for adding widget script to every page.
*
* @see hook_page_bottom()
*/
function tawk_to_page_bottom(array &$page_bottom): void {
$page_bottom['tawk_to_widget'] = [
'#lazy_builder' => [
'tawk_to.embed_render:render',
[],
],
'#create_placeholder' => TRUE,
];
}
/**
* Implements hook_theme().
*/
function tawk_to_theme(): array {
return [
'tawk_to' => [
'variables' => [
'items' => [],
],
],
'tawk_to_iframe' => [
'variables' => [
'items' => [],
],
],
];
}