FEATURE: change directory structure

This commit is contained in:
Michal Kváček
2016-10-17 00:07:21 +02:00
parent 87f1920373
commit 2ded2924a1
242 changed files with 742 additions and 1171 deletions
+63
View File
@@ -0,0 +1,63 @@
<?php
namespace App\CMS\Widgets\HtmlCode;
use App\CMS\Contracts\Widgets\PublicWidget;
use App\CMS\Widgets\Contracts\WidgetRenderer;
use App\CMS\Widgets\Exceptions\MissingParameterException;
use App\Models\Widgets\Widget;
class HtmlCode implements PublicWidget
{
/**
* Name getter
*
* @return string
*/
public static function getName()
{
return 'widgets/htmlCode.widgetName';
}
/**
* Getter for description
*
* @return string
*/
public static function getDescription()
{
return 'widgets/htmlCode.widgetDescription';
}
/**
* Getter for presenter/renderer of this widget
*
* @return WidgetRenderer
*/
public static function getPresenter()
{
return Presenters\HtmlCode::class;
}
/**
* @param Widget $widget
* @param \stdClass $data
*
* @return Widget
* @throws MissingParameterException
*/
public static function save(Widget $widget, \stdClass $data)
{
if (!isset($data->code) || empty($data->code)) {
throw new MissingParameterException('code');
}
$widgetSettings = [
'code' => $data->code,
'containerClass' => isset($data->containerClass) ? $data->containerClass : ''
];
$widget->settings = json_encode($widgetSettings);
return $widget;
}
}