forked from FriendsOfREDAXO/mblock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.php
44 lines (37 loc) · 1.46 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
<?php
/**
* @author mail[at]joachim-doerr[dot]com Joachim Doerr
* @package redaxo5
* @license MIT
*/
if (rex::isBackend() && is_object(rex::getUser())) {
// check theme css exists
MBlockThemeHelper::themeBootCheck($this->getConfig('mblock_theme'));
// use theme helper class
if (MBlockThemeHelper::getCssAssets($this->getConfig('mblock_theme'))) {
// foreach all css files
foreach (MBlockThemeHelper::getCssAssets($this->getConfig('mblock_theme')) as $css) {
// add assets css file
rex_view::addCssFile($this->getAssetsUrl($css));
}
}
// register extensions
// alfred post post
rex_extension::register('REX_FORM_SAVED', function (rex_extension_point $params) {
/** @var rex_form|null $form */
$form = ($params->hasParam('form')) ? $params->getParam('form') : null;
if ($form instanceof mblock_rex_form)
return MBlockRexFormProcessor::postPostSaveAction($params->getSubject(), $form, $_POST); // execute post post
else
return $params->getSubject();
});
// assets
rex_view::addJsFile($this->getAssetsUrl('mblock_sortable.min.js'));
rex_view::addJsFile($this->getAssetsUrl('mblock_smooth_scroll.min.js'));
rex_view::addJsFile($this->getAssetsUrl('mblock.js'));
rex_view::addCssFile($this->getAssetsUrl('mblock.css'));
}
if (isset($_SESSION['mblock_count'])) {
// reset mblock page count
$_SESSION['mblock_count'] = 0;
}