FEATURE: prepare widget for displaying menu on onepage templates
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
namespace Templates\Base\OnePage\Widgets\OnePageMenu;
|
||||
|
||||
use App\Models\Widget;
|
||||
use App\Widgets\Contracts\WidgetRenderer;
|
||||
use App\Widgets\NonInstallableWidget;
|
||||
use stdClass;
|
||||
|
||||
class OnePageMenu extends NonInstallableWidget
|
||||
{
|
||||
/**
|
||||
* Name getter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getName()
|
||||
{
|
||||
return 'template::widget/menu.name';
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getDescription()
|
||||
{
|
||||
return 'template::widget/menu.description';
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for presenter/renderer of this widget
|
||||
*
|
||||
* @return WidgetRenderer
|
||||
*/
|
||||
public static function getPresenter()
|
||||
{
|
||||
return Presenter::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Widget $widget
|
||||
* @param stdClass $data
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function save(Widget $widget, stdClass $data)
|
||||
{
|
||||
$widgetSettings = ['containerClass' => isset($data->containerClass) ? $data->containerClass : ''];
|
||||
|
||||
$widget->settings = json_encode($widgetSettings);
|
||||
|
||||
return $widget;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user