Skip to content

Commit 09a7547

Browse files
authored
Merge pull request #372 from rainlab/next
[2.x] Major Upgrade for Tailor Importer
2 parents 7242c5b + 99b4d23 commit 09a7547

File tree

312 files changed

+16570
-9661
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

312 files changed

+16570
-9661
lines changed

LICENCE.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
# MIT license
1+
# License
22

3-
Permission is hereby granted, free of charge, to any person obtaining a copy of
4-
this software and associated documentation files (the "Software"), to deal in
5-
the Software without restriction, including without limitation the rights to
6-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7-
of the Software, and to permit persons to whom the Software is furnished to do
8-
so, subject to the following conditions:
9-
10-
The above copyright notice and this permission notice shall be included in all
11-
copies or substantial portions of the Software.
12-
13-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19-
SOFTWARE.
3+
See End User License Agreement at https://octobercms.com/eula

Plugin.php

Lines changed: 89 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,135 @@
11
<?php namespace RainLab\Builder;
22

3-
use Event;
43
use Lang;
4+
use Event;
55
use Backend;
66
use System\Classes\PluginBase;
7-
use System\Classes\CombineAssets;
87
use RainLab\Builder\Classes\StandardControlsRegistry;
98
use RainLab\Builder\Classes\StandardBehaviorsRegistry;
9+
use RainLab\Builder\Classes\StandardBlueprintsRegistry;
1010
use RainLab\Builder\Rules\Reserved;
1111
use Doctrine\DBAL\Types\Type as DoctrineType;
12-
use Validator;
1312

13+
/**
14+
* Plugin registration file
15+
*/
1416
class Plugin extends PluginBase
1517
{
18+
/**
19+
* pluginDetails
20+
*/
1621
public function pluginDetails()
1722
{
1823
return [
19-
'name' => 'rainlab.builder::lang.plugin.name',
20-
'description' => 'rainlab.builder::lang.plugin.description',
21-
'author' => 'Alexey Bobkov, Samuel Georges',
22-
'icon' => 'icon-wrench',
23-
'homepage' => 'https://github.com/rainlab/builder-plugin'
24+
'name' => "Builder",
25+
'description' => "Provides visual tools for building October plugins.",
26+
'author' => 'Alexey Bobkov, Samuel Georges',
27+
'icon' => 'icon-wrench',
28+
'homepage' => 'https://github.com/rainlab/builder-plugin'
2429
];
2530
}
2631

32+
/**
33+
* registerComponents
34+
*/
2735
public function registerComponents()
2836
{
2937
return [
30-
'RainLab\Builder\Components\RecordList' => 'builderList',
31-
'RainLab\Builder\Components\RecordDetails' => 'builderDetails'
38+
\RainLab\Builder\Components\RecordList::class => 'builderList',
39+
\RainLab\Builder\Components\RecordDetails::class => 'builderDetails'
3240
];
3341
}
3442

43+
/**
44+
* registerPermissions
45+
*/
3546
public function registerPermissions()
3647
{
3748
return [
3849
'rainlab.builder.manage_plugins' => [
39-
'tab' => 'rainlab.builder::lang.plugin.name',
40-
'label' => 'rainlab.builder::lang.plugin.manage_plugins']
50+
'tab' => "Builder",
51+
'label' => 'rainlab.builder::lang.plugin.manage_plugins'
52+
]
4153
];
4254
}
4355

56+
/**
57+
* registerNavigation
58+
*/
4459
public function registerNavigation()
4560
{
4661
return [
4762
'builder' => [
48-
'label' => 'rainlab.builder::lang.plugin.name',
49-
'url' => Backend::url('rainlab/builder'),
50-
'icon' => 'icon-wrench',
51-
'iconSvg' => 'plugins/rainlab/builder/assets/images/builder-icon.svg',
63+
'label' => "Builder",
64+
'url' => Backend::url('rainlab/builder'),
65+
'icon' => 'icon-wrench',
66+
'iconSvg' => 'plugins/rainlab/builder/assets/images/builder-icon.svg',
5267
'permissions' => ['rainlab.builder.manage_plugins'],
53-
'order' => 400,
68+
'order' => 400,
5469
'useDropdown' => false,
5570

5671
'sideMenu' => [
5772
'database' => [
58-
'label' => 'rainlab.builder::lang.database.menu_label',
59-
'icon' => 'icon-hdd-o',
60-
'url' => 'javascript:;',
61-
'attributes' => ['data-menu-item'=>'database'],
73+
'label' => 'rainlab.builder::lang.database.menu_label',
74+
'icon' => 'icon-hdd-o',
75+
'url' => 'javascript:;',
76+
'attributes' => ['data-menu-item' => 'database'],
6277
'permissions' => ['rainlab.builder.manage_plugins']
6378
],
6479
'models' => [
65-
'label' => 'rainlab.builder::lang.model.menu_label',
66-
'icon' => 'icon-random',
67-
'url' => 'javascript:;',
68-
'attributes' => ['data-menu-item'=>'models'],
80+
'label' => 'rainlab.builder::lang.model.menu_label',
81+
'icon' => 'icon-random',
82+
'url' => 'javascript:;',
83+
'attributes' => ['data-menu-item' => 'models'],
6984
'permissions' => ['rainlab.builder.manage_plugins']
7085
],
7186
'permissions' => [
72-
'label' => 'rainlab.builder::lang.permission.menu_label',
73-
'icon' => 'icon-unlock-alt',
74-
'url' => '#',
75-
'attributes' => ['data-no-side-panel'=>'true', 'data-builder-command'=>'permission:cmdOpenPermissions', 'data-menu-item'=>'permissions'],
87+
'label' => 'rainlab.builder::lang.permission.menu_label',
88+
'icon' => 'icon-unlock-alt',
89+
'url' => 'javascript:;',
90+
'attributes' => ['data-no-side-panel' => 'true', 'data-builder-command' => 'permission:cmdOpenPermissions', 'data-menu-item' => 'permissions'],
7691
'permissions' => ['rainlab.builder.manage_plugins']
7792
],
7893
'menus' => [
79-
'label' => 'rainlab.builder::lang.menu.menu_label',
80-
'icon' => 'icon-location-arrow',
81-
'url' => 'javascript:;',
82-
'attributes' => ['data-no-side-panel'=>'true', 'data-builder-command'=>'menus:cmdOpenMenus', 'data-menu-item'=>'menus'],
94+
'label' => 'rainlab.builder::lang.menu.menu_label',
95+
'icon' => 'icon-location-arrow',
96+
'url' => 'javascript:;',
97+
'attributes' => ['data-no-side-panel' => 'true', 'data-builder-command' => 'menus:cmdOpenMenus', 'data-menu-item' => 'menus'],
8398
'permissions' => ['rainlab.builder.manage_plugins']
8499
],
85100
'controllers' => [
86-
'label' => 'rainlab.builder::lang.controller.menu_label',
87-
'icon' => 'icon-asterisk',
88-
'url' => 'javascript:;',
89-
'attributes' => ['data-menu-item'=>'controllers'],
101+
'label' => 'rainlab.builder::lang.controller.menu_label',
102+
'icon' => 'icon-asterisk',
103+
'url' => 'javascript:;',
104+
'attributes' => ['data-menu-item' => 'controllers'],
90105
'permissions' => ['rainlab.builder.manage_plugins']
91106
],
92107
'versions' => [
93-
'label' => 'rainlab.builder::lang.version.menu_label',
94-
'icon' => 'icon-code-fork',
95-
'url' => 'javascript:;',
96-
'attributes' => ['data-menu-item'=>'version'],
108+
'label' => 'rainlab.builder::lang.version.menu_label',
109+
'icon' => 'icon-code-fork',
110+
'url' => 'javascript:;',
111+
'attributes' => ['data-menu-item' => 'version'],
97112
'permissions' => ['rainlab.builder.manage_plugins']
98113
],
99114
'localization' => [
100-
'label' => 'rainlab.builder::lang.localization.menu_label',
101-
'icon' => 'icon-globe',
102-
'url' => 'javascript:;',
103-
'attributes' => ['data-menu-item'=>'localization'],
115+
'label' => 'rainlab.builder::lang.localization.menu_label',
116+
'icon' => 'icon-globe',
117+
'url' => 'javascript:;',
118+
'attributes' => ['data-menu-item' => 'localization'],
119+
'permissions' => ['rainlab.builder.manage_plugins']
120+
],
121+
'code' => [
122+
'label' => 'Code',
123+
'icon' => 'icon-file-code-o',
124+
'url' => 'javascript:;',
125+
'attributes' => ['data-menu-item' => 'code'],
126+
'permissions' => ['rainlab.builder.manage_plugins']
127+
],
128+
'imports' => [
129+
'label' => 'Import',
130+
'icon' => 'icon-arrow-circle-down',
131+
'url' => 'javascript:;',
132+
'attributes' => ['data-no-side-panel' => 'true', 'data-builder-command' => 'imports:cmdOpenImports', 'data-menu-item' => 'imports'],
104133
'permissions' => ['rainlab.builder.manage_plugins']
105134
]
106135
]
@@ -109,16 +138,19 @@ public function registerNavigation()
109138
];
110139
}
111140

141+
/**
142+
* registerSettings
143+
*/
112144
public function registerSettings()
113145
{
114146
return [
115147
'config' => [
116-
'label' => 'Builder',
117-
'icon' => 'icon-wrench',
148+
'label' => 'Builder',
149+
'icon' => 'icon-wrench',
118150
'description' => 'Set your author name and namespace for plugin creation.',
119-
'class' => 'RainLab\Builder\Models\Settings',
151+
'class' => 'RainLab\Builder\Models\Settings',
120152
'permissions' => ['rainlab.builder.manage_plugins'],
121-
'order' => 600
153+
'order' => 600
122154
]
123155
];
124156
}
@@ -136,47 +168,28 @@ public function boot()
136168
new StandardBehaviorsRegistry($behaviorLibrary);
137169
});
138170

171+
Event::listen('pages.builder.registerTailorBlueprints', function ($blueprintLibrary) {
172+
new StandardBlueprintsRegistry($blueprintLibrary);
173+
});
174+
139175
// Register reserved keyword validation
140176
Event::listen('translator.beforeResolve', function ($key, $replaces, $locale) {
141177
if ($key === 'validation.reserved') {
142178
return Lang::get('rainlab.builder::lang.validation.reserved');
143179
}
144180
});
145181

146-
// Compatibility with v1 legacy
147-
if (!class_exists('System')) {
148-
Validator::extend('reserved', Reserved::class);
149-
Validator::replacer('reserved', function ($message, $attribute, $rule, $parameters) {
182+
$this->callAfterResolving('validator', function ($validator) {
183+
$validator->extend('reserved', Reserved::class);
184+
$validator->replacer('reserved', function ($message, $attribute, $rule, $parameters) {
150185
// Fixes lowercase attribute names in the new plugin modal form
151186
return ucfirst($message);
152187
});
153-
}
154-
else {
155-
$this->callAfterResolving('validator', function ($validator) {
156-
$validator->extend('reserved', Reserved::class);
157-
$validator->replacer('reserved', function ($message, $attribute, $rule, $parameters) {
158-
// Fixes lowercase attribute names in the new plugin modal form
159-
return ucfirst($message);
160-
});
161-
});
162-
}
188+
});
163189

164190
// Register doctrine types
165191
if (!DoctrineType::hasType('timestamp')) {
166192
DoctrineType::addType('timestamp', \RainLab\Builder\Classes\Doctrine\TimestampType::class);
167193
}
168194
}
169-
170-
/**
171-
* register
172-
*/
173-
public function register()
174-
{
175-
/*
176-
* Register asset bundles
177-
*/
178-
CombineAssets::registerCallback(function ($combiner) {
179-
$combiner->registerBundle('$/rainlab/builder/assets/js/build.js');
180-
});
181-
}
182195
}

0 commit comments

Comments
 (0)