REFACTORING: move method prepareSettings from presenter into widget handler
This commit is contained in:
@@ -87,11 +87,47 @@ class OrbitSlider implements PublicWidget
|
||||
'code' => $request->code
|
||||
];
|
||||
|
||||
$widget->settings = json_encode($settings);
|
||||
$widget->settings = self::createSettings($settings);
|
||||
|
||||
return $widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for populating settings array with default values
|
||||
*
|
||||
* @param $settings
|
||||
*/
|
||||
public static function prepareSettings(&$settings)
|
||||
{
|
||||
if (!isset($settings->slideContainerClass)) {
|
||||
$settings->slideContainerClass = '';
|
||||
}
|
||||
|
||||
if (!isset($settings->displayBullets)) {
|
||||
$settings->displayBullets = true;
|
||||
}
|
||||
|
||||
if (!isset($settings->imagePerSlide)) {
|
||||
$settings->imagePerSlide = 4;
|
||||
}
|
||||
|
||||
if (!isset($settings->directoryId)) {
|
||||
$settings->directoryId = false;
|
||||
}
|
||||
if (!isset($settings->sliderClass)) {
|
||||
$settings->sliderClass = '';
|
||||
}
|
||||
if (!isset($settings->code)) {
|
||||
$settings->code = '';
|
||||
}
|
||||
}
|
||||
|
||||
public static function createSettings($settings) {
|
||||
self::prepareSettings($settings);
|
||||
|
||||
return json_encode($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for presenter/renderer of this widget
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user