-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.php
More file actions
48 lines (41 loc) · 1.36 KB
/
Plugin.php
File metadata and controls
48 lines (41 loc) · 1.36 KB
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
<?php namespace Asyntai\Chatbot;
use Event;
use System\Classes\PluginBase;
use Asyntai\Chatbot\Models\Settings as AsyntaiSettings;
class Plugin extends PluginBase
{
public function pluginDetails()
{
return [
'name' => 'Asyntai - AI Chatbot',
'description' => 'AI assistant / chatbot – Provides instant answers to your website visitors',
'author' => 'Asyntai',
'icon' => 'icon-comments'
];
}
public function registerSettings()
{
return [
'settings' => [
'label' => 'Asyntai AI Chatbot',
'description' => 'Asyntai - AI Chatbot',
'category' => 'Asyntai AI Chatbot',
'icon' => 'icon-comments',
'class' => AsyntaiSettings::class,
'order' => 500,
'keywords' => 'asyntai ai chatbot',
]
];
}
public function boot()
{
Event::listen('cms.page.beforeRenderPage', function ($controller, $page) {
$siteId = trim((string) AsyntaiSettings::getSiteId());
if ($siteId === '') {
return;
}
$scriptUrl = trim((string) AsyntaiSettings::getScriptUrl());
$controller->addJs($scriptUrl, ['data-asyntai-id' => $siteId, 'async' => true, 'defer' => true]);
});
}
}