FEATURE: *in progress* working on menu widgets
This commit is contained in:
@@ -3,5 +3,13 @@ namespace App\Widgets\Contracts;
|
||||
|
||||
interface MenuExtensionHandler {
|
||||
|
||||
public static function getPossibleValues();
|
||||
public function getName();
|
||||
public function getDescription();
|
||||
public function getId();
|
||||
|
||||
public function getPossibleValues();
|
||||
|
||||
public function getFormExtensionTemplate();
|
||||
|
||||
public function save();
|
||||
}
|
||||
@@ -4,8 +4,33 @@ namespace App\Widgets\Menu\Extensions;
|
||||
use App\Widgets\Contracts\MenuExtensionHandler;
|
||||
|
||||
class URL implements MenuExtensionHandler {
|
||||
public static function getPossibleValues()
|
||||
public function getPossibleValues()
|
||||
{
|
||||
// TODO: Implement getPossibleValues() method.
|
||||
return '*';
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return 'url';
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return trans('widgets/menu.extensionURL');
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return trans('widgets/menu.extensionURLDescription');
|
||||
}
|
||||
|
||||
public function getFormExtensionTemplate()
|
||||
{
|
||||
return 'admin.widgets.menu.extensions.url';
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
// TODO: Implement save() method.
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,9 @@ namespace App\Widgets\Menu;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Widgets\Contracts\WidgetRenderer;
|
||||
use App\Widgets\Widget;
|
||||
use App\Widgets\NonInstallableWidget;
|
||||
|
||||
class Menu extends Widget
|
||||
class Menu extends NonInstallableWidget
|
||||
{
|
||||
/**
|
||||
* Name getter
|
||||
@@ -14,7 +14,7 @@ class Menu extends Widget
|
||||
*/
|
||||
public static function getName()
|
||||
{
|
||||
return 'widgets/menu.name';
|
||||
return 'widgets/menu.widgetName';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,7 +24,7 @@ class Menu extends Widget
|
||||
*/
|
||||
public static function getDescription()
|
||||
{
|
||||
return 'widgets/menu.description';
|
||||
return 'widgets/menu.widgetDescription';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,24 +45,6 @@ class Menu extends Widget
|
||||
*/
|
||||
public static function save(\App\Models\Widget $widget, Request $request)
|
||||
{
|
||||
// TODO: Implement save() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for installing given widget
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function install()
|
||||
{
|
||||
// TODO: Implement install() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for uninstalling widget
|
||||
*/
|
||||
public static function uninstall()
|
||||
{
|
||||
// TODO: Implement uninstall() method.
|
||||
return $widget;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace App\Widgets\Menu\Presenters;
|
||||
use App\Models\Widget;
|
||||
use App\Models\WidgetType;
|
||||
use App\Widgets\Contracts\WidgetRenderer;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class Menu implements WidgetRenderer
|
||||
{
|
||||
@@ -18,7 +19,7 @@ class Menu implements WidgetRenderer
|
||||
*/
|
||||
public static function render($settings)
|
||||
{
|
||||
// TODO: Implement render() method.
|
||||
return json_encode($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +31,16 @@ class Menu implements WidgetRenderer
|
||||
*/
|
||||
public static function renderAddForm(WidgetType $type)
|
||||
{
|
||||
// TODO: Implement renderAddForm() method.
|
||||
$extensions = App::make('registerMenuExtension')
|
||||
->get();
|
||||
|
||||
$widget = new Widget();
|
||||
|
||||
return view('admin.widgets.menu.new', [
|
||||
'type' => $type,
|
||||
'widget' => $widget,
|
||||
'extensions' => $extensions
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,6 +52,9 @@ class Menu implements WidgetRenderer
|
||||
*/
|
||||
public static function renderEditForm(Widget $widget)
|
||||
{
|
||||
// TODO: Implement renderEditForm() method.
|
||||
$extensions = App::make('registerMenuExtension')
|
||||
->get();
|
||||
|
||||
return view('admin.widgets.menu.edit', ['widget' => $widget]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user