diff --git a/Observer/AddBlock.php b/Observer/AddBlock.php index 097c161..8ff7ea1 100644 --- a/Observer/AddBlock.php +++ b/Observer/AddBlock.php @@ -85,22 +85,24 @@ public function execute(Observer $observer) $output = $observer->getTransport()->getOutput(); foreach ($this->helperData->getActiveSliders() as $slider) { - $locations = array_filter(explode(',', $slider->getLocation())); - foreach ($locations as $value) { - list($pageType, $location) = explode('.', $value); - if (($fullActionName === $pageType || $pageType === 'allpage') && - strpos($location, $type) !== false - ) { - $content = $layout->createBlock(Slider::class) - ->setSlider($slider) - ->toHtml(); + if (!empty($slider->getLocation())) { + $locations = array_filter(explode(',', $slider->getLocation())); + foreach ($locations as $value) { + list($pageType, $location) = explode('.', $value); + if (($fullActionName === $pageType || $pageType === 'allpage') && + strpos($location, $type) !== false + ) { + $content = $layout->createBlock(Slider::class) + ->setSlider($slider) + ->toHtml(); - if (strpos($location, 'top') !== false) { - $output = "
getId()}\"> - $content
" . $output; - } else { - $output .= "
getId()}\"> - $content
"; + if (strpos($location, 'top') !== false) { + $output = "
getId()}\"> + $content
" . $output; + } else { + $output .= "
getId()}\"> + $content
"; + } } } }