-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
58 lines (50 loc) · 2.15 KB
/
Copy pathindex.php
File metadata and controls
58 lines (50 loc) · 2.15 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
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/*
* Embed element addon for Bear CMS
* https://github.com/bearcms/embed-element-addon
* Copyright (c) Amplilabs Ltd.
* Free to use under the MIT license.
*/
use BearFramework\App;
$app = App::get();
$app->bearCMS->addons
->register('bearcms/embed-element-addon', function (\BearCMS\Addons\Addon $addon) use ($app): void {
$addon->initialize = function () use ($app): void {
$context = $app->contexts->get(__DIR__);
$context->assets->addDir('assets');
$app->localization
->addDictionary('en', function () use ($context) {
return include $context->dir . '/locales/en.php';
})
->addDictionary('bg', function () use ($context) {
return include $context->dir . '/locales/bg.php';
});
$type = new \BearCMS\Internal\ElementType('embed', 'bearcms-embed-element', $context->dir . '/components/embedElement.php');
$type->properties = [
[
'id' => 'value',
'type' => 'string'
],
[
'id' => 'aspectRatio',
'type' => 'string'
],
[
'id' => 'height',
'type' => 'string'
]
];
\BearCMS\Internal\ElementsTypes::add($type);
\BearCMS\Internal\Themes::$elementsOptions['embed'] = function ($options, $idPrefix, $parentSelector, $context, $details): void {
$group = $options->addGroup(__('bearcms.themes.options.Embed'));
$group->addOption($idPrefix . "EmbedCSS", "css", '', [
"cssTypes" => ["cssBorder", "cssRadius", "cssShadow"],
"cssOptions" => isset($details['cssOptions']) ? $details['cssOptions'] : [],
"cssOutput" => [
["rule", $parentSelector . " .bearcms-embed-element", "overflow:hidden;"],
["selector", $parentSelector . " .bearcms-embed-element"]
]
]);
};
};
});