first
This commit is contained in:
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Nextend\SmartSlider3\SlideBuilder;
|
||||
|
||||
abstract class AbstractBuilderComponent {
|
||||
|
||||
protected $defaultData = array();
|
||||
|
||||
protected $data = array();
|
||||
|
||||
|
||||
public function set($keyOrData, $value = null) {
|
||||
|
||||
if (is_array($keyOrData)) {
|
||||
foreach ($keyOrData as $key => $value) {
|
||||
$this->setSingle($key, $value);
|
||||
}
|
||||
} else {
|
||||
$this->setSingle($keyOrData, $value);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function setSingle($key, $value) {
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
|
||||
public function getData() {
|
||||
return array_merge($this->defaultData, $this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AbstractBuilderComponent $component
|
||||
*/
|
||||
public function add($component) {
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\SlideBuilder;
|
||||
|
||||
class BuilderComponentCol extends AbstractBuilderComponent {
|
||||
|
||||
protected $defaultData = array(
|
||||
"type" => 'col',
|
||||
"name" => 'Column',
|
||||
"colwidth" => '1/1',
|
||||
"layers" => array(),
|
||||
"desktopportraitpadding" => '10|*|10|*|10|*|10|*|px'
|
||||
);
|
||||
|
||||
/** @var AbstractBuilderComponent[] */
|
||||
private $layers = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param BuilderComponentRow $container
|
||||
* @param $width
|
||||
*/
|
||||
public function __construct($container, $width = '1/1') {
|
||||
|
||||
$this->defaultData['colwidth'] = $width;
|
||||
|
||||
$container->add($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $layer AbstractBuilderComponent
|
||||
*/
|
||||
public function add($layer) {
|
||||
$this->layers[] = $layer;
|
||||
}
|
||||
|
||||
public function getData() {
|
||||
$this->data['layers'] = array();
|
||||
foreach ($this->layers as $layer) {
|
||||
$this->data['layers'][] = $layer->getData();
|
||||
}
|
||||
|
||||
return parent::getData();
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\SlideBuilder;
|
||||
|
||||
|
||||
class BuilderComponentContent extends AbstractBuilderComponent {
|
||||
|
||||
protected $defaultData = array(
|
||||
"type" => 'content',
|
||||
"name" => 'Content',
|
||||
"desktopportraitpadding" => '0|*|0|*|0|*|0|*|px'
|
||||
);
|
||||
|
||||
/** @var AbstractBuilderComponent[] */
|
||||
private $layers = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param AbstractBuilderComponent $container
|
||||
*/
|
||||
public function __construct($container) {
|
||||
|
||||
$container->add($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $layer AbstractBuilderComponent
|
||||
*/
|
||||
public function add($layer) {
|
||||
$this->layers[] = $layer;
|
||||
}
|
||||
|
||||
public function getData() {
|
||||
$this->data['layers'] = array();
|
||||
foreach ($this->layers as $layer) {
|
||||
$this->data['layers'][] = $layer->getData();
|
||||
}
|
||||
|
||||
return parent::getData();
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\SlideBuilder;
|
||||
|
||||
use Nextend\SmartSlider3\Renderable\Item;
|
||||
|
||||
class BuilderComponentItem extends AbstractBuilderComponent {
|
||||
|
||||
/**
|
||||
* @var Item\AbstractItem
|
||||
*/
|
||||
protected $item;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param AbstractBuilderComponent $container
|
||||
* @param string $type
|
||||
*/
|
||||
public function __construct($container, $type) {
|
||||
$this->item = Item\ItemFactory::getItem($type);
|
||||
$this->defaultData = array_merge($this->defaultData, $this->item->getValues());
|
||||
|
||||
$container->add($this);
|
||||
}
|
||||
|
||||
public function getData() {
|
||||
return array(
|
||||
'type' => $this->item->getType(),
|
||||
'values' => parent::getData()
|
||||
);
|
||||
}
|
||||
|
||||
public function getLabel() {
|
||||
return $this->item->getTitle();
|
||||
}
|
||||
|
||||
public function getLayerProperties() {
|
||||
return $this->item->getLayerProperties();
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\SlideBuilder;
|
||||
|
||||
|
||||
class BuilderComponentLayer extends AbstractBuilderComponent {
|
||||
|
||||
protected $defaultData = array(
|
||||
"type" => 'layer',
|
||||
"eye" => false,
|
||||
"lock" => false,
|
||||
"animations" => array(
|
||||
"specialZeroIn" => 0,
|
||||
"transformOriginIn" => "50|*|50|*|0",
|
||||
"inPlayEvent" => "",
|
||||
"loopRepeatSelfOnly" => 0,
|
||||
"repeatCount" => 0,
|
||||
"repeatStartDelay" => 0,
|
||||
"transformOriginLoop" => "50|*|50|*|0",
|
||||
"loopPlayEvent" => "",
|
||||
"loopPauseEvent" => "",
|
||||
"loopStopEvent" => "",
|
||||
"transformOriginOut" => "50|*|50|*|0",
|
||||
"outPlayEvent" => "",
|
||||
"in" => array(),
|
||||
"loop" => array(),
|
||||
"out" => array()
|
||||
),
|
||||
"id" => null,
|
||||
"parentid" => null,
|
||||
"name" => "Layer",
|
||||
"namesynced" => 1,
|
||||
"crop" => "visible",
|
||||
"inneralign" => "left",
|
||||
"parallax" => 0,
|
||||
"desktopportrait" => 1,
|
||||
"desktoplandscape" => 1,
|
||||
"tabletportrait" => 1,
|
||||
"tabletlandscape" => 1,
|
||||
"mobileportrait" => 1,
|
||||
"mobilelandscape" => 1,
|
||||
"responsiveposition" => 1,
|
||||
"responsivesize" => 1,
|
||||
"desktopportraitleft" => 0,
|
||||
"desktopportraittop" => 0,
|
||||
"desktopportraitwidth" => "auto",
|
||||
"desktopportraitheight" => "auto",
|
||||
"desktopportraitalign" => "center",
|
||||
"desktopportraitvalign" => "middle",
|
||||
"desktopportraitparentalign" => "center",
|
||||
"desktopportraitparentvalign" => "middle",
|
||||
"desktopportraitfontsize" => 100
|
||||
|
||||
);
|
||||
|
||||
/** @var BuilderComponentItem */
|
||||
public $item;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param AbstractBuilderComponent $container
|
||||
* @param string $item
|
||||
*/
|
||||
public function __construct($container, $item) {
|
||||
|
||||
$container->add($this);
|
||||
|
||||
new BuilderComponentItem($this, $item);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $component BuilderComponentItem
|
||||
*/
|
||||
public function add($component) {
|
||||
$this->item = $component;
|
||||
|
||||
foreach ($this->item->getLayerProperties() as $k => $v) {
|
||||
if ($k == 'width' || $k == 'height' || $k == 'top' || $k == 'left') {
|
||||
$this->defaultData['desktopportrait' . $k] = $v;
|
||||
} else {
|
||||
$this->defaultData[$k] = $v;
|
||||
}
|
||||
}
|
||||
$this->defaultData['name'] = $this->item->getLabel() . ' layer';
|
||||
}
|
||||
|
||||
public function getData() {
|
||||
$this->data['item'] = $this->item->getData();
|
||||
|
||||
|
||||
return parent::getData();
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\SmartSlider3\SlideBuilder;
|
||||
|
||||
|
||||
class BuilderComponentRow extends AbstractBuilderComponent {
|
||||
|
||||
protected $defaultData = array(
|
||||
"type" => 'row',
|
||||
"name" => 'Row',
|
||||
"cols" => array(),
|
||||
"desktopportraitpadding" => '10|*|10|*|10|*|10|*|px'
|
||||
);
|
||||
|
||||
/** @var BuilderComponentCol[] */
|
||||
private $cols = array();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param AbstractBuilderComponent $container
|
||||
*/
|
||||
public function __construct($container) {
|
||||
|
||||
$container->add($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $layer BuilderComponentCol
|
||||
*/
|
||||
public function add($layer) {
|
||||
$this->cols[] = $layer;
|
||||
}
|
||||
|
||||
public function getData() {
|
||||
$this->data['cols'] = array();
|
||||
foreach ($this->cols as $layer) {
|
||||
$this->data['cols'][] = $layer->getData();
|
||||
}
|
||||
|
||||
return parent::getData();
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Nextend\SmartSlider3\SlideBuilder;
|
||||
|
||||
class BuilderComponentSlide extends AbstractBuilderComponent {
|
||||
|
||||
protected $data = array(
|
||||
'title' => '',
|
||||
'published' => 1,
|
||||
'first' => 0,
|
||||
'description' => '',
|
||||
'thumbnail' => '',
|
||||
'ordering' => 0,
|
||||
'generator_id' => 0,
|
||||
"static-slide" => 0,
|
||||
"backgroundColor" => "ffffff00",
|
||||
"backgroundImage" => "",
|
||||
"backgroundImageOpacity" => 100,
|
||||
"backgroundAlt" => "",
|
||||
"backgroundTitle" => "",
|
||||
"backgroundMode" => "default",
|
||||
"backgroundVideoMp4" => "",
|
||||
"backgroundVideoOpacity" => 100,
|
||||
"backgroundVideoLoop" => 1,
|
||||
"backgroundVideoReset" => 1,
|
||||
"backgroundVideoMode" => "fill",
|
||||
"href" => "",
|
||||
"href-target" => "",
|
||||
"slide-duration" => 0,
|
||||
"desktopportraitpadding" => '10|*|10|*|10|*|10'
|
||||
);
|
||||
|
||||
/** @var AbstractBuilderComponent[] */
|
||||
private $layers = array();
|
||||
|
||||
/** @var BuilderComponentContent */
|
||||
public $content;
|
||||
|
||||
public function __construct($properties = array()) {
|
||||
foreach ($properties as $k => $v) {
|
||||
$this->data[$k] = $v;
|
||||
}
|
||||
|
||||
$this->content = new BuilderComponentContent($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $layer AbstractBuilderComponent
|
||||
*/
|
||||
public function add($layer) {
|
||||
array_unshift($this->layers, $layer);
|
||||
}
|
||||
|
||||
public function getData() {
|
||||
$this->data['layers'] = array();
|
||||
foreach ($this->layers as $layer) {
|
||||
$this->data['layers'][] = $layer->getData();
|
||||
}
|
||||
|
||||
return parent::getData();
|
||||
}
|
||||
|
||||
public function getLayersData() {
|
||||
$data = $this->getData();
|
||||
|
||||
return $data['layers'];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user