: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
namespace Nextend\SmartSlider3\Renderable;
use Nextend\Framework\Notification\Notification;
use Nextend\SmartSlider3\Renderable\Component\AbstractComponent;
use Nextend\SmartSlider3\Renderable\Component\ComponentCol;
use Nextend\SmartSlider3\Renderable\Component\ComponentContent;
use Nextend\SmartSlider3\Renderable\Component\ComponentLayer;
use Nextend\SmartSlider3\Renderable\Component\ComponentRow;
use Nextend\SmartSlider3\Slider\Slide;
class ComponentContainer {
/** @var AbstractComponent[] */
protected $layers = array();
/** @var AbstractComponent */
* @param AbstractComponent $component
* @param array $componentsData
public function __construct($slide, $component, $componentsData) {
$this->component = $component;
if (is_array($componentsData)) {
if ($component->getType() == 'slide') {
$componentsData = array_reverse($componentsData);
foreach ($componentsData as $componentData) {
$this->addComponent($componentData);
private function addComponent($componentData) {
if (!isset($componentData['type'])) {
$componentData['type'] = 'layer';
switch ($componentData['type']) {
$this->layers[] = new ComponentContent($this->index, $this->slide, $this->component, $componentData);
$this->layers[] = new ComponentRow($this->index, $this->slide, $this->component, $componentData);
$this->layers[] = new ComponentCol($this->index, $this->slide, $this->component, $componentData);
if (empty($componentData['item'])) {
if (empty($componentData['items'])) {
$componentData['item'] = $componentData['items'][0];
$layer = new ComponentLayer($this->index, $this->slide, $this->component, $componentData);
$this->layers[] = $layer;
Notification::error($e->getMessage());
$componentData['layers'] = array_reverse($componentData['layers']);
foreach ($componentData['layers'] as $subComponentData) {
$this->addComponent($subComponentData);
public function addContentLayer($slide, $component) {
$layerCount = count($this->layers);
for ($i = 0; $i < $layerCount; $i++) {
if ($this->layers[$i] instanceof ComponentContent) {
$content = $this->layers[$i];
if ($content === false) {
array_unshift($this->layers, new ComponentContent($layerCount + 1, $slide, $component, array(
'bgcolorgradient' => 'off',
'verticalalign' => 'center',
'desktopportraitinneralign' => 'inherit',
'desktopportraitpadding' => '10|*|10|*|10|*|10|*|px',
* @return AbstractComponent[]
public function getLayers() {
public function render($isAdmin) {
foreach ($this->layers as $layer) {
$html .= $layer->render($isAdmin);