-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.php
58 lines (47 loc) · 1.82 KB
/
plugin.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
50
51
52
53
54
55
56
57
58
<?php
declare(strict_types=1);
/**
* @link https://flextype.org
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flextype\Plugin\Blueprints;
use Flextype\Plugin\Blueprints\Blueprints;
use Flextype\Plugin\Blueprints\Twig\Extension\BlueprintsTwigExtension;
use function array_merge;
use function strtolower;
use function substr;
use function is_file;
/**
* Ensure vendor libraries exist
*/
! is_file($blueprints_autoload = __DIR__ . '/vendor/autoload.php') and exit('Please run: <i>composer install</i> form plugin');
/**
* Register The Auto Loader
*
* Composer provides a convenient, automatically generated class loader for
* our application. We just need to utilize it! We'll simply require it
* into the script here so that we don't have to worry about manual
* loading any of our classes later on. It feels nice to relax.
* Register The Auto Loader
*/
$blueprints_loader = require_once $blueprints_autoload;
/**
* Add Blueprints Model to Flextype container
*/
container()->set('blueprints', new Blueprints(registry()->get('plugins.blueprints.settings.entries')));
/**
* Add Blueprints Twig Extension
*/
twig()->addExtension(new BlueprintsTwigExtension());
$blueprintsJS[] = 'project/plugins/blueprints/assets/dist/js/blueprints.min.js';
$blueprintsCSS[] = 'project/plugins/blueprints/assets/dist/css/blueprints.min.css';
if (registry()->get('plugins.blueprints.settings.assetsLoadOnAdmin')) {
registry()->set('assets.admin.js.blueprints', $blueprintsJS);
registry()->set('assets.admin.css.blueprints', $blueprintsCSS);
}
if (registry()->get('plugins.blueprints.settings.assetsLoadOnSite')) {
registry()->set('assets.site.js.blueprints', $blueprintsJS);
registry()->set('assets.site.css.blueprints', $blueprintsCSS);
}