Merge branch 'dev' into doucovanineratovice.cz
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
namespace Templates\Base\OnePage\Handlers;
|
||||
|
||||
use App\Handlers\Contracts\TemplateHandler;
|
||||
use App\Helpers\CurrentTemplate;
|
||||
use App\Helpers\PageRenderer;
|
||||
use App\Helpers\Settings;
|
||||
use App\Helpers\Template;
|
||||
@@ -10,7 +11,12 @@ use App\Models\Content;
|
||||
use App\Models\Module;
|
||||
use App\Models\Settings as SettingsModel;
|
||||
use App\Models\User;
|
||||
use App\Models\Widget;
|
||||
use App\Models\WidgetArea;
|
||||
use App\Models\WidgetInWidgetArea;
|
||||
use App\Models\WidgetType;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Templates\Base\OnePage\Widgets\OnePageMenu\OnePageMenu;
|
||||
|
||||
abstract class OnePage implements TemplateHandler
|
||||
{
|
||||
@@ -133,6 +139,32 @@ abstract class OnePage implements TemplateHandler
|
||||
foreach ($types as $type) {
|
||||
ActionLogType::create($type);
|
||||
}
|
||||
|
||||
// try to create onepage menu widget
|
||||
$widgetName = OnePageMenu::getName();
|
||||
$widgetDescription = OnePageMenu::getDescription();
|
||||
|
||||
CurrentTemplate::reset();
|
||||
|
||||
// create row in widget types
|
||||
WidgetType::create([
|
||||
'handler' => OnePageMenu::class,
|
||||
'name' => $widgetName,
|
||||
'module_id' => null,
|
||||
'template_id' => CurrentTemplate::get()->id,
|
||||
'description' => $widgetDescription
|
||||
]);
|
||||
|
||||
$area = WidgetArea::create(['name' => 'Top menu', 'code' => 'topMenu', 'deletable' => 0]);
|
||||
$widget = Widget::create([
|
||||
'widget_type_handler' => OnePageMenu::class,
|
||||
'name' => 'Menu',
|
||||
'settings' => '{"containerClass": null}',
|
||||
'deletable' => 0
|
||||
]);
|
||||
|
||||
// bind widget with widget area
|
||||
WidgetInWidgetArea::create(['widget_id' => $widget->id, 'widget_area_id' => $area->id, 'position' => 1]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user