-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathboot.php
More file actions
45 lines (36 loc) · 1.99 KB
/
boot.php
File metadata and controls
45 lines (36 loc) · 1.99 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
<?php
rex_perm::register('slice_columns[edit]');
if (rex::isBackend() && rex::getUser() && \rex_be_controller::getCurrentPagePart(1) ==='content') {
$addon = rex_addon::get('slice_columns');
rex_view::setJsProperty('slicesteps', (int)$addon->getConfig('number_steps'));
rex_view::setJsProperty('min_width_column', (int)$addon->getConfig('min_width_column'));
rex_view::setJsProperty('number_columns', (int)$addon->getConfig('number_columns'));
// Load assets only on content pages - bloecks handles drag & drop (required dependency)
switch (\rex_be_controller::getCurrentPagePart(1)) {
case 'content':
rex_view::addCssFile($addon->getAssetsUrl('columns.css'));
rex_view::addJsFile($addon->getAssetsUrl('columns_sortablejs.js'));
default:
break;
}
// templates ausschließen
$templates = [];
$templatesConfig = $addon->getConfig('templates','');
if (!empty($templatesConfig)) {
$templates = explode("|", $templatesConfig);
}
$currentTemplate = rex_article::getCurrent() ? rex_article::getCurrent()->getTemplateId() : null;
$excludeTemplate = !empty($templates) && $currentTemplate && in_array($currentTemplate, $templates);
if (!$excludeTemplate) {
// add buttons to slice menu
rex_extension::register('SLICE_MENU', ['columns', 'addButtons']);
}
// Register with LATE priority to run after bloecks
rex_extension::register('SLICE_SHOW', array('columns', 'show'), rex_extension::LATE);
} elseif(rex::isFrontend()) {
// rex_extension::register('ART_CONTENT', array('columns', 'frontend'));
// rex_extension::register('STRUCTURE_CONTENT_BEFORE_SLICES', array('columns', 'frontend'));
// rex_extension::register('STRUCTURE_CONTENT_AFTER_SLICES', array('columns', 'frontend'));
// rex_extension::register('SLICE_OUTPUT', array('columns', 'frontend'));
rex_extension::register('SLICE_SHOW', array('columns', 'frontend'), rex_extension::LATE);
}