FEATURE: add functionality for rendering widgets via shortcode [widget]
This commit is contained in:
@@ -46,9 +46,7 @@ class OnePageMenu extends NonInstallableWidget
|
||||
*/
|
||||
public static function save(Widget $widget, stdClass $data)
|
||||
{
|
||||
$widgetSettings = ['containerClass' => isset($data->containerClass) ? $data->containerClass : ''];
|
||||
|
||||
$widget->settings = json_encode($widgetSettings);
|
||||
$widget->settings = json_encode([]);
|
||||
|
||||
return $widget;
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ class Presenter implements WidgetRenderer
|
||||
*
|
||||
* This method renders some HTML code for displaying.
|
||||
*
|
||||
* @param object $settings
|
||||
* @param Widget $widget
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \ErrorException
|
||||
*/
|
||||
public static function render($settings)
|
||||
public static function render(Widget $widget)
|
||||
{
|
||||
if (!self::$template) {
|
||||
throw new \ErrorException('Cannot render menu without template! Please, set Presenter::$template variable before rendering.');
|
||||
@@ -31,7 +31,7 @@ class Presenter implements WidgetRenderer
|
||||
|
||||
$pages = OnePage::getPagesOnHomepage();
|
||||
|
||||
return view(self::$template, ['pages' => $pages])->render();
|
||||
return view(self::$template, ['pages' => $pages, 'widget' => $widget])->render();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user