-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathboot.php
49 lines (44 loc) · 1.82 KB
/
boot.php
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
<?php
/**
* @var rex_addon $this
* @psalm-scope-this rex_addon
*/
rex_ycom_auth::addInjection(new rex_ycom_injection_otp(), 1);
rex_ycom_auth::addInjection(new rex_ycom_injection_passwordchange(), 4);
rex_ycom_auth::addInjection(new rex_ycom_injection_termsofuse(), 8);
if (rex::isBackend()) {
rex_extension::register('PACKAGES_INCLUDED', static function ($params) {
$addon = rex_addon::get('yform');
$plugin = rex_plugin::get('yform', 'manager');
if ($plugin->isAvailable()) {
// YForm <= 5
$pages = $plugin->getProperty('pages');
$ycom_tables = rex_ycom::getTables();
if (isset($pages) && is_array($pages)) {
foreach ($pages as $page) {
if (in_array($page->getKey(), $ycom_tables, true)) {
$page->setBlock('ycom');
// $page->setRequiredPermissions('ycom[]');
}
}
}
} else {
// YForm >= 5
$pages = $addon->getProperty('pages');
$ycom_tables = rex_ycom::getTables();
if (isset($pages) && is_array($pages)) {
foreach ($pages as $page) {
if (in_array($page->getKey(), $ycom_tables, true)) {
$page->setBlock('ycom');
// $page->setRequiredPermissions('ycom[]');
}
}
}
}
});
}
rex_ycom::addTable(rex::getTablePrefix() . 'ycom_user');
rex_yform_manager_dataset::setModelClass(rex::getTablePrefix() . 'ycom_user', rex_ycom_user::class);
if (rex::isBackend() && ('index.php?page=content/edit' === rex_url::currentBackendPage() || 'mediapool' === rex_be_controller::getCurrentPagePart(1))) {
rex_view::addJsFile($this->getAssetsUrl('ycom_backend.js'));
}