-
Notifications
You must be signed in to change notification settings - Fork 12
/
BuilderRegister.php
92 lines (81 loc) · 2.5 KB
/
BuilderRegister.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* @package Goomento_PageBuilder
* @link https://github.com/Goomento/PageBuilder
*/
declare(strict_types=1);
namespace Goomento\PageBuilder;
use Goomento\PageBuilder\Builder\Managers\Widgets;
use Goomento\PageBuilder\Builder\Managers\Elements;
use Goomento\PageBuilder\Helper\HooksHelper;
use Goomento\PageBuilder\Helper\ThemeHelper;
// phpcs:disable Magento2.CodeAnalysis.EmptyBlock.DetectedFunction
class BuilderRegister implements BuildableInterface
{
/**
* If `PageBuilder` will be initialized for the first time, this method will be executed
*
* @param array $buildSubject
*/
public function init(array $buildSubject = [])
{
// Register the widget to be used
HooksHelper::addAction('pagebuilder/elements/categories_registered', [$this, 'registerWidgetCategories']);
HooksHelper::addAction('pagebuilder/widgets/widgets_registered', [$this, 'registerWidgets']);
// Register the default resource css, js files
HooksHelper::addAction('pagebuilder/register_styles', [$this, 'registerStyles']);
HooksHelper::addAction('pagebuilder/register_scripts', [$this, 'registerScripts']);
// Print resource (css, js files) if needed
HooksHelper::addAction('pagebuilder/enqueue_scripts', [$this, 'enqueueScripts']);
}
/**
* Add widget categories, where is grouping the similar functionality
* Eg: Elements::addCategory('category-alias', [
* 'title' => __('Category title'),
* ])
*
*
* @param Elements $elements
* @see Elements::addCategory()
*/
public function registerWidgetCategories(Elements $elements)
{
}
/**
* Add your widgets to be used here
*
* @see Widgets::registerWidgetType()
*/
public function registerWidgets(Widgets $widgetsManager)
{
}
/**
* Add to queue your css files, that can be used by widget
*
* @see ThemeHelper::registerStyle()
*/
public function registerStyles()
{
}
/**
* Add to queue your js files, that can be used by widget
*
* @see ThemeHelper::registerScript()
*/
public function registerScripts()
{
}
/**
* If you need to add the css, js file into HTML output, now it's the time
*
* The css files will be added in <link> tag
*
* The js files will be called by requireJs
*
* @see ThemeHelper::enqueueScript()
* @see ThemeHelper::enqueueStyle()
*/
public function enqueueScripts()
{
}
}