Skip to content

Commit

Permalink
Merge pull request #372 from rainlab/next
Browse files Browse the repository at this point in the history
[2.x] Major Upgrade for Tailor Importer
  • Loading branch information
daftspunk authored May 1, 2023
2 parents 7242c5b + 99b4d23 commit 09a7547
Show file tree
Hide file tree
Showing 312 changed files with 16,570 additions and 9,661 deletions.
20 changes: 2 additions & 18 deletions LICENCE.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
# MIT license
# License

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
See End User License Agreement at https://octobercms.com/eula
165 changes: 89 additions & 76 deletions Plugin.php
Original file line number Diff line number Diff line change
@@ -1,106 +1,135 @@
<?php namespace RainLab\Builder;

use Event;
use Lang;
use Event;
use Backend;
use System\Classes\PluginBase;
use System\Classes\CombineAssets;
use RainLab\Builder\Classes\StandardControlsRegistry;
use RainLab\Builder\Classes\StandardBehaviorsRegistry;
use RainLab\Builder\Classes\StandardBlueprintsRegistry;
use RainLab\Builder\Rules\Reserved;
use Doctrine\DBAL\Types\Type as DoctrineType;
use Validator;

/**
* Plugin registration file
*/
class Plugin extends PluginBase
{
/**
* pluginDetails
*/
public function pluginDetails()
{
return [
'name' => 'rainlab.builder::lang.plugin.name',
'description' => 'rainlab.builder::lang.plugin.description',
'author' => 'Alexey Bobkov, Samuel Georges',
'icon' => 'icon-wrench',
'homepage' => 'https://github.com/rainlab/builder-plugin'
'name' => "Builder",
'description' => "Provides visual tools for building October plugins.",
'author' => 'Alexey Bobkov, Samuel Georges',
'icon' => 'icon-wrench',
'homepage' => 'https://github.com/rainlab/builder-plugin'
];
}

/**
* registerComponents
*/
public function registerComponents()
{
return [
'RainLab\Builder\Components\RecordList' => 'builderList',
'RainLab\Builder\Components\RecordDetails' => 'builderDetails'
\RainLab\Builder\Components\RecordList::class => 'builderList',
\RainLab\Builder\Components\RecordDetails::class => 'builderDetails'
];
}

/**
* registerPermissions
*/
public function registerPermissions()
{
return [
'rainlab.builder.manage_plugins' => [
'tab' => 'rainlab.builder::lang.plugin.name',
'label' => 'rainlab.builder::lang.plugin.manage_plugins']
'tab' => "Builder",
'label' => 'rainlab.builder::lang.plugin.manage_plugins'
]
];
}

/**
* registerNavigation
*/
public function registerNavigation()
{
return [
'builder' => [
'label' => 'rainlab.builder::lang.plugin.name',
'url' => Backend::url('rainlab/builder'),
'icon' => 'icon-wrench',
'iconSvg' => 'plugins/rainlab/builder/assets/images/builder-icon.svg',
'label' => "Builder",
'url' => Backend::url('rainlab/builder'),
'icon' => 'icon-wrench',
'iconSvg' => 'plugins/rainlab/builder/assets/images/builder-icon.svg',
'permissions' => ['rainlab.builder.manage_plugins'],
'order' => 400,
'order' => 400,
'useDropdown' => false,

'sideMenu' => [
'database' => [
'label' => 'rainlab.builder::lang.database.menu_label',
'icon' => 'icon-hdd-o',
'url' => 'javascript:;',
'attributes' => ['data-menu-item'=>'database'],
'label' => 'rainlab.builder::lang.database.menu_label',
'icon' => 'icon-hdd-o',
'url' => 'javascript:;',
'attributes' => ['data-menu-item' => 'database'],
'permissions' => ['rainlab.builder.manage_plugins']
],
'models' => [
'label' => 'rainlab.builder::lang.model.menu_label',
'icon' => 'icon-random',
'url' => 'javascript:;',
'attributes' => ['data-menu-item'=>'models'],
'label' => 'rainlab.builder::lang.model.menu_label',
'icon' => 'icon-random',
'url' => 'javascript:;',
'attributes' => ['data-menu-item' => 'models'],
'permissions' => ['rainlab.builder.manage_plugins']
],
'permissions' => [
'label' => 'rainlab.builder::lang.permission.menu_label',
'icon' => 'icon-unlock-alt',
'url' => '#',
'attributes' => ['data-no-side-panel'=>'true', 'data-builder-command'=>'permission:cmdOpenPermissions', 'data-menu-item'=>'permissions'],
'label' => 'rainlab.builder::lang.permission.menu_label',
'icon' => 'icon-unlock-alt',
'url' => 'javascript:;',
'attributes' => ['data-no-side-panel' => 'true', 'data-builder-command' => 'permission:cmdOpenPermissions', 'data-menu-item' => 'permissions'],
'permissions' => ['rainlab.builder.manage_plugins']
],
'menus' => [
'label' => 'rainlab.builder::lang.menu.menu_label',
'icon' => 'icon-location-arrow',
'url' => 'javascript:;',
'attributes' => ['data-no-side-panel'=>'true', 'data-builder-command'=>'menus:cmdOpenMenus', 'data-menu-item'=>'menus'],
'label' => 'rainlab.builder::lang.menu.menu_label',
'icon' => 'icon-location-arrow',
'url' => 'javascript:;',
'attributes' => ['data-no-side-panel' => 'true', 'data-builder-command' => 'menus:cmdOpenMenus', 'data-menu-item' => 'menus'],
'permissions' => ['rainlab.builder.manage_plugins']
],
'controllers' => [
'label' => 'rainlab.builder::lang.controller.menu_label',
'icon' => 'icon-asterisk',
'url' => 'javascript:;',
'attributes' => ['data-menu-item'=>'controllers'],
'label' => 'rainlab.builder::lang.controller.menu_label',
'icon' => 'icon-asterisk',
'url' => 'javascript:;',
'attributes' => ['data-menu-item' => 'controllers'],
'permissions' => ['rainlab.builder.manage_plugins']
],
'versions' => [
'label' => 'rainlab.builder::lang.version.menu_label',
'icon' => 'icon-code-fork',
'url' => 'javascript:;',
'attributes' => ['data-menu-item'=>'version'],
'label' => 'rainlab.builder::lang.version.menu_label',
'icon' => 'icon-code-fork',
'url' => 'javascript:;',
'attributes' => ['data-menu-item' => 'version'],
'permissions' => ['rainlab.builder.manage_plugins']
],
'localization' => [
'label' => 'rainlab.builder::lang.localization.menu_label',
'icon' => 'icon-globe',
'url' => 'javascript:;',
'attributes' => ['data-menu-item'=>'localization'],
'label' => 'rainlab.builder::lang.localization.menu_label',
'icon' => 'icon-globe',
'url' => 'javascript:;',
'attributes' => ['data-menu-item' => 'localization'],
'permissions' => ['rainlab.builder.manage_plugins']
],
'code' => [
'label' => 'Code',
'icon' => 'icon-file-code-o',
'url' => 'javascript:;',
'attributes' => ['data-menu-item' => 'code'],
'permissions' => ['rainlab.builder.manage_plugins']
],
'imports' => [
'label' => 'Import',
'icon' => 'icon-arrow-circle-down',
'url' => 'javascript:;',
'attributes' => ['data-no-side-panel' => 'true', 'data-builder-command' => 'imports:cmdOpenImports', 'data-menu-item' => 'imports'],
'permissions' => ['rainlab.builder.manage_plugins']
]
]
Expand All @@ -109,16 +138,19 @@ public function registerNavigation()
];
}

/**
* registerSettings
*/
public function registerSettings()
{
return [
'config' => [
'label' => 'Builder',
'icon' => 'icon-wrench',
'label' => 'Builder',
'icon' => 'icon-wrench',
'description' => 'Set your author name and namespace for plugin creation.',
'class' => 'RainLab\Builder\Models\Settings',
'class' => 'RainLab\Builder\Models\Settings',
'permissions' => ['rainlab.builder.manage_plugins'],
'order' => 600
'order' => 600
]
];
}
Expand All @@ -136,47 +168,28 @@ public function boot()
new StandardBehaviorsRegistry($behaviorLibrary);
});

Event::listen('pages.builder.registerTailorBlueprints', function ($blueprintLibrary) {
new StandardBlueprintsRegistry($blueprintLibrary);
});

// Register reserved keyword validation
Event::listen('translator.beforeResolve', function ($key, $replaces, $locale) {
if ($key === 'validation.reserved') {
return Lang::get('rainlab.builder::lang.validation.reserved');
}
});

// Compatibility with v1 legacy
if (!class_exists('System')) {
Validator::extend('reserved', Reserved::class);
Validator::replacer('reserved', function ($message, $attribute, $rule, $parameters) {
$this->callAfterResolving('validator', function ($validator) {
$validator->extend('reserved', Reserved::class);
$validator->replacer('reserved', function ($message, $attribute, $rule, $parameters) {
// Fixes lowercase attribute names in the new plugin modal form
return ucfirst($message);
});
}
else {
$this->callAfterResolving('validator', function ($validator) {
$validator->extend('reserved', Reserved::class);
$validator->replacer('reserved', function ($message, $attribute, $rule, $parameters) {
// Fixes lowercase attribute names in the new plugin modal form
return ucfirst($message);
});
});
}
});

// Register doctrine types
if (!DoctrineType::hasType('timestamp')) {
DoctrineType::addType('timestamp', \RainLab\Builder\Classes\Doctrine\TimestampType::class);
}
}

/**
* register
*/
public function register()
{
/*
* Register asset bundles
*/
CombineAssets::registerCallback(function ($combiner) {
$combiner->registerBundle('$/rainlab/builder/assets/js/build.js');
});
}
}
Loading

0 comments on commit 09a7547

Please sign in to comment.