0

I am trying to add category selector in my block page without UI component. This is my block file.

   <?php

namespace Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab;

use Magento\Backend\Block\Template\Context;
use Magento\Backend\Block\Widget\Button;
use Magento\Backend\Block\Widget\Form\Element\Dependence;
use Magento\Backend\Block\Widget\Form\Generic;
use Magento\Backend\Block\Widget\Tab\TabInterface;
use Magento\Cms\Model\Wysiwyg\Config as WysiwygConfig;
use Magento\Config\Model\Config\Source\Enabledisable;
use Magento\Config\Model\Config\Structure\Element\Dependency\FieldFactory;
use Magento\Framework\Convert\DataObject;
use Magento\Framework\Data\FormFactory;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Registry;
use Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab\Render\Image as BannerImage;
use Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab\Render\Slider;
use Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Chooser;
use Uedakanamono\BannerSlider\Helper\Data;
use Uedakanamono\BannerSlider\Helper\Image as HelperImage;
use Uedakanamono\BannerSlider\Model\Config\Source\Template;
use Uedakanamono\BannerSlider\Model\Config\Source\Type;
use Magento\Framework\Stdlib\DateTime;

/**
 * Class Banner
 * @package Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab
 */
class Banner extends Generic implements TabInterface
{
    /**
     * Type options
     *
     * @var Type
     */
    protected $typeOptions;

    /**
     * Template options
     *
     * @var Template
     */
    protected $template;

    /**
     * Status options
     *
     * @var Enabledisable
     */
    protected $statusOptions;

    /**
     * @var HelperImage
     */
    protected $imageHelper;

    /**
     * @var FieldFactory
     */
    protected $_fieldFactory;

    /**
     * @var DataObject
     */
    protected $_objectConverter;

    /**
     * @var WysiwygConfig
     */
    protected $_wysiwygConfig;

    /**
     * Banner constructor.
     *
     * @param Type $typeOptions
     * @param Template $template
     * @param Enabledisable $statusOptions
     * @param Context $context
     * @param Registry $registry
     * @param FormFactory $formFactory
     * @param HelperImage $imageHelper
     * @param FieldFactory $fieldFactory
     * @param DataObject $objectConverter
     * @param WysiwygConfig $wysiwygConfig
     * @param array $data
     */
    public function __construct(
        Type $typeOptions,
        Template $template,
        Enabledisable $statusOptions,
        Context $context,
        Registry $registry,
        FormFactory $formFactory,
        HelperImage $imageHelper,
        FieldFactory $fieldFactory,
        DataObject $objectConverter,
        WysiwygConfig $wysiwygConfig,
        array $data = []
    ) {
        $this->typeOptions = $typeOptions;
        $this->template = $template;
        $this->statusOptions = $statusOptions;
        $this->imageHelper = $imageHelper;
        $this->_fieldFactory = $fieldFactory;
        $this->_objectConverter = $objectConverter;
        $this->_wysiwygConfig = $wysiwygConfig;

        parent::__construct($context, $registry, $formFactory, $data);
    }

    /**
     * Prepare title for tab
     *
     * @return string
     */
    public function getTabTitle()
    {
        return $this->getTabLabel();
    }

    /**
     * Prepare label for tab
     *
     * @return string
     */
    public function getTabLabel()
    {
        return __('General');
    }

    /**
     * Can show tab in tabs
     *
     * @return boolean
     */
    public function canShowTab()
    {
        return true;
    }

    /**
     * Tab is hidden
     *
     * @return boolean
     */
    public function isHidden()
    {
        return false;
    }

    /**
     * @return Generic
     * @throws LocalizedException
     */
    protected function _prepareForm()
    {
        /** @var \Uedakanamono\BannerSlider\Model\Banner $banner */
        $banner = $this->_coreRegistry->registry('mpbannerslider_banner');
        $form = $this->_formFactory->create();
        $form->setHtmlIdPrefix('banner_');
        $form->setFieldNameSuffix('banner');
        $fieldset = $form->addFieldset('base_fieldset', [
            'legend' => __('Banner Information'),
            'class' => 'fieldset-wide'
        ]);

        if ($banner->getId()) {
            $fieldset->addField(
                'banner_id',
                'hidden',
                ['name' => 'banner_id']
            );
        }

        $fieldset->addField('name', 'text', [
            'name' => 'name',
            'label' => __('Banner Title'),
            'title' => __('Banner Title'),
            'required' => true,
        ]);

        $fieldset->addField('status', 'select', [
            'name' => 'status',
            'label' => __('Status'),
            'title' => __('Status'),
            'values' => $this->statusOptions->toOptionArray(),
        ]);

        $fieldset->addField(
            'category_ids',
            '\Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Chooser',
            [
                'name' => 'category_ids',
                'label' => __('Categories'),
                'title' => __('Categories'),
                'required' => true
            ]
        );
        

        $uploadBanner = $fieldset->addField('image', BannerImage::class, [
            'name' => 'image',
            'label' => __('Upload Image'),
            'title' => __('Upload Image'),
            'path' => $this->imageHelper->getBaseMediaPath(HelperImage::TEMPLATE_MEDIA_TYPE_BANNER)
        ]);

        $titleBanner = $fieldset->addField('title', 'text', [
            'name' => 'title',
            'label' => __('Banner SubTitle'),
            'title' => __('Banner SubTitle'),
        ]);

        $urlBanner = $fieldset->addField('url_banner', 'text', [
            'name' => 'url_banner',
            'label' => __('Url'),
            'title' => __('Url'),
            'class' => 'validate-url validate-no-html-tags'
        ]);

        $newTab = $fieldset->addField('newtab', 'select', [
            'name' => 'newtab',
            'label' => __('Open new tab after click'),
            'title' => __('Open new tab after click'),
            'values' => $this->statusOptions->toOptionArray(),
            'note' => __('Automatically open new tab after clicking on the banner')

        ]);

        $orderBanner = $fieldset->addField('vieworder', 'text', [
            'name' => 'vieworder',
            'label' => __('Display Order'),
            'title' => __('Display Order'),
        ]);
        $fieldset->addField('banner_from_date', 'date', [
            'name' => 'banner_from_date',
            'label' => __('Banner Start Date'),
            'title' => __('Banner Start Date'),
            'date_format' => 'yyyy/MM/dd',
            'input_format' => DateTime::DATE_INTERNAL_FORMAT,
            'timezone' => false
        ]);

        $fieldset->addField('banner_to_date', 'date', [
            'name' => 'banner_to_date',
            'label' => __('Banner End Date'),
            'title' => __('Banner End Date'),
            'date_format' => 'yyyy/MM/dd',
            'input_format' => DateTime::DATE_INTERNAL_FORMAT,
            'timezone' => false
        ]);
        

        $fieldset->addField('sliders_ids', Slider::class, [
            'name' => 'sliders_ids',
            'label' => __('Sliders'),
            'title' => __('Sliders'),
        ]);
        if (!$banner->getSlidersIds()) {
            $banner->setSlidersIds($banner->getSliderIds());
        }

        $bannerData = $this->_session->getData('mpbannerslider_banner_data', true);
        if ($bannerData) {
            $banner->addData($bannerData);
        } else {
            if (!$banner->getId()) {
                $banner->addData($banner->getDefaultValues());
            }
        }

        $form->addValues($banner->getData());
        $this->setForm($form);

        return parent::_prepareForm();
    }
}

As you can see, I add fieldset name of category_ids. And then this is my chooser.php

    <?php
namespace Uedakanamono\BannerSlider\Block\Adminhtml\Banner;

use Magento\Catalog\Model\Category as CategoryModel;
use Magento\Framework\AuthorizationInterface;
use Magento\Framework\Data\Form\Element\CollectionFactory;
use Magento\Framework\Data\Form\Element\Factory;
use Magento\Framework\Data\Form\Element\Multiselect;
use Magento\Framework\Escaper;
use Magento\Framework\UrlInterface;

class Chooser extends Multiselect
{

    public $collectionFactory;

    public $authorization;

    protected $_urlBuilder;

    public function __construct(
        Factory $factoryElement,
        CollectionFactory $factoryCollection,
        Escaper $escaper,
        \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $collectionFactory,
        AuthorizationInterface $authorization,
        UrlInterface $urlBuilder,
        array $data = []
    ) {
        $this->collectionFactory = $collectionFactory;
        $this->authorization = $authorization;
        $this->_urlBuilder = $urlBuilder;

        parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
    }

    public function getElementHtml()
    {
        $html = '<div class="admin__field-control admin__control-grouped">';
        $html .= '<div id="topbanner-category-select" class="admin__field" data-bind="scope:\'topbannerCategory\'" data-index="index">';
        $html .= '<!-- ko foreach: elems() -->';
        $html .= '<input name="category_ids" data-bind="value: value" style="display: none"/>';
        $html .= '<!-- ko template: elementTmpl --><!-- /ko -->';
        $html .= '<!-- /ko -->';
        $html .= '</div></div>';

        $html .= $this->getAfterElementHtml();

        return $html;
    }

    public function getCategoriesTree()
    {
        /* @var $collection \Magento\Catalog\Model\ResourceModel\Category\Collection */
        $collection = $this->collectionFactory->create()->addAttributeToSelect('name')->addAttributeToSort('position','asc');

        $categoryById = [
            CategoryModel::TREE_ROOT_ID => [
                'value'    => CategoryModel::TREE_ROOT_ID,
                'optgroup' => null,
            ],
        ];

        foreach ($collection as $category) {
            foreach ([$category->getId(), $category->getParentId()] as $categoryId) {
                if (!isset($categoryById[$categoryId])) {
                    $categoryById[$categoryId] = ['value' => $categoryId];
                }
            }

            $categoryById[$category->getId()]['is_active'] = 1;
            $categoryById[$category->getId()]['label'] = $category->getName();
            $categoryById[$category->getParentId()]['optgroup'][] = &$categoryById[$category->getId()];
        }

        return $categoryById[CategoryModel::TREE_ROOT_ID]['optgroup'];
    }

    public function getValues()
    {
        $values = $this->getValue();
        if (!is_array($values)) {
            $values = explode(',', $values);
        }

        if (!sizeof($values)) {
            return [];
        }

        $collection = $this->collectionFactory->create()
            ->addIdFilter($values);

        $options = [];
        foreach ($collection as $category) {
            $options[] = $category->getId();
        }

        return $options;
    }

    public function getAfterElementHtml()
    {
        $html = '<script type="text/x-magento-init">
            {
                "*": {
                    "Magento_Ui/js/core/app": {
                        "components": {
                            "topbannerCategory": {
                                "component": "uiComponent",
                                "children": {
                                    "select_category": {
                                        "component": "Vendor_Module/js/components/new-category",
                                        "config": {
                                            "filterOptions": true,
                                            "disableLabel": true,
                                            "chipsEnabled": true,
                                            "levelsVisibility": "1",
                                            "elementTmpl": "ui/grid/filters/elements/ui-select",
                                            "options": ' . json_encode($this->getCategoriesTree()) . ',
                                            "value": ' . json_encode($this->getValues()) . ',
                                            "listens": {
                                                "index=create_category:responseData": "setParsed",
                                                "newOption": "toggleOptionSelected"
                                            },
                                            "config": {
                                                "dataScope": "select_category",
                                                "sortOrder": 10
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        </script>';

        return $html;
    }

}

After run, error is occured.

    [2023-07-03T09:42:33.892733+00:00] main.CRITICAL: Exception: Deprecated Functionality: explode(): Passing null to parameter #2 ($string) of type string is deprecated in F:\xampp\htdocs\magento2\app\code\Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Chooser.php on line 83 in F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\App\ErrorHandler.php:62
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(8192, 'explode(): Pass...', 'F:\\xampp\\htdocs...', 83)
#1 F:\xampp\htdocs\magento2\app\code\Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Chooser.php(83): explode(',', NULL)
#2 F:\xampp\htdocs\magento2\app\code\Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Chooser.php(120): Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Chooser->getValues()
#3 F:\xampp\htdocs\magento2\app\code\Magento\Backend\view\adminhtml\templates\widget\form\renderer\fieldset\element.phtml(12): Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Chooser->getAfterElementHtml()
#4 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\TemplateEngine\Php.php(71): include('F:\\xampp\\htdocs...')
#5 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\Template.php(263): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element), 'F:/xampp/htdocs...', Array)
#6 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\Template.php(293): Magento\Framework\View\Element\Template->fetchView('F:/xampp/htdocs...')
#7 F:\xampp\htdocs\magento2\app\code\Magento\Backend\Block\Template.php(141): Magento\Framework\View\Element\Template->_toHtml()
#8 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(1095): Magento\Backend\Block\Template->_toHtml()
#9 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(1099): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}()
#10 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(660): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#11 F:\xampp\htdocs\magento2\app\code\Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element.php(46): Magento\Framework\View\Element\AbstractBlock->toHtml()
#12 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\Data\Form\Element\AbstractElement.php(541): Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element->render(Object(Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Chooser))
#13 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\Data\Form\Element\AbstractElement.php(555): Magento\Framework\Data\Form\Element\AbstractElement->getHtml()
#14 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\Data\Form\Element\Fieldset.php(232): Magento\Framework\Data\Form\Element\AbstractElement->toHtml()
#15 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\Data\Form\Element\Fieldset.php(109): Magento\Framework\Data\Form\Element\Fieldset->_elementsToHtml(Array)
#16 F:\xampp\htdocs\magento2\generated\code\Magento\Framework\Data\Form\Element\Fieldset\Interceptor.php(59): Magento\Framework\Data\Form\Element\Fieldset->getBasicChildrenHtml()
#17 F:\xampp\htdocs\magento2\app\code\Magento\Backend\view\adminhtml\templates\widget\form\renderer\fieldset.phtml(84): Magento\Framework\Data\Form\Element\Fieldset\Interceptor->getBasicChildrenHtml()
#18 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\TemplateEngine\Php.php(71): include('F:\\xampp\\htdocs...')
#19 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\Template.php(263): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\Backend\Block\Widget\Form\Renderer\Fieldset), 'F:/xampp/htdocs...', Array)
#20 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\Template.php(293): Magento\Framework\View\Element\Template->fetchView('F:/xampp/htdocs...')
#21 F:\xampp\htdocs\magento2\app\code\Magento\Backend\Block\Template.php(141): Magento\Framework\View\Element\Template->_toHtml()
#22 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(1095): Magento\Backend\Block\Template->_toHtml()
#23 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(1099): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}()
#24 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(660): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#25 F:\xampp\htdocs\magento2\app\code\Magento\Backend\Block\Widget\Form\Renderer\Fieldset.php(50): Magento\Framework\View\Element\AbstractBlock->toHtml()
#26 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\Data\Form\Element\AbstractElement.php(541): Magento\Backend\Block\Widget\Form\Renderer\Fieldset->render(Object(Magento\Framework\Data\Form\Element\Fieldset\Interceptor))
#27 F:\xampp\htdocs\magento2\generated\code\Magento\Framework\Data\Form\Element\Fieldset\Interceptor.php(338): Magento\Framework\Data\Form\Element\AbstractElement->getHtml()
#28 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\Data\Form\Element\AbstractElement.php(555): Magento\Framework\Data\Form\Element\Fieldset\Interceptor->getHtml()
#29 F:\xampp\htdocs\magento2\generated\code\Magento\Framework\Data\Form\Element\Fieldset\Interceptor.php(347): Magento\Framework\Data\Form\Element\AbstractElement->toHtml()
#30 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\Data\Form.php(373): Magento\Framework\Data\Form\Element\Fieldset\Interceptor->toHtml()
#31 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\Data\Form.php(390): Magento\Framework\Data\Form->toHtml()
#32 F:\xampp\htdocs\magento2\app\code\Magento\Backend\Block\Widget\Form.php(113): Magento\Framework\Data\Form->getHtml()
#33 F:\xampp\htdocs\magento2\generated\code\Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab\Banner\Interceptor.php(68): Magento\Backend\Block\Widget\Form->getFormHtml()
#34 F:\xampp\htdocs\magento2\app\code\Magento\Backend\view\adminhtml\templates\widget\form.phtml(13): Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab\Banner\Interceptor->getFormHtml()
#35 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\TemplateEngine\Php.php(71): include('F:\\xampp\\htdocs...')
#36 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\Template.php(263): Magento\Framework\View\TemplateEngine\Php->render(Object(Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab\Banner\Interceptor), 'F:/xampp/htdocs...', Array)
#37 F:\xampp\htdocs\magento2\generated\code\Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab\Banner\Interceptor.php(221): Magento\Framework\View\Element\Template->fetchView('F:/xampp/htdocs...')
#38 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\Template.php(293): Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab\Banner\Interceptor->fetchView('F:/xampp/htdocs...')
#39 F:\xampp\htdocs\magento2\app\code\Magento\Backend\Block\Template.php(141): Magento\Framework\View\Element\Template->_toHtml()
#40 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(1095): Magento\Backend\Block\Template->_toHtml()
#41 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(1099): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}()
#42 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(660): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#43 F:\xampp\htdocs\magento2\generated\code\Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab\Banner\Interceptor.php(446): Magento\Framework\View\Element\AbstractBlock->toHtml()
#44 F:\xampp\htdocs\magento2\app\code\Magento\Backend\Block\Widget\Tabs.php(492): Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab\Banner\Interceptor->toHtml()
#45 F:\xampp\htdocs\magento2\app\code\Magento\Backend\view\adminhtml\templates\widget\tabs.phtml(73): Magento\Backend\Block\Widget\Tabs->getTabContent(Object(Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tab\Banner\Interceptor))
#46 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\TemplateEngine\Php.php(71): include('F:\\xampp\\htdocs...')
#47 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\Template.php(263): Magento\Framework\View\TemplateEngine\Php->render(Object(Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Edit\Tabs), 'F:/xampp/htdocs...', Array)
#48 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\Template.php(293): Magento\Framework\View\Element\Template->fetchView('F:/xampp/htdocs...')
#49 F:\xampp\htdocs\magento2\app\code\Magento\Backend\Block\Template.php(141): Magento\Framework\View\Element\Template->_toHtml()
#50 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(1095): Magento\Backend\Block\Template->_toHtml()
#51 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(1099): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}()
#52 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Element\AbstractBlock.php(660): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#53 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Layout.php(578): Magento\Framework\View\Element\AbstractBlock->toHtml()
#54 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Layout.php(555): Magento\Framework\View\Layout->_renderBlock('Uedakanamono_ba...')
#55 F:\xampp\htdocs\magento2\generated\code\Magento\Framework\View\Layout\Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement('Uedakanamono_ba...')
#56 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('Uedakanamono_ba...')
#57 F:\xampp\htdocs\magento2\generated\code\Magento\Framework\View\Layout\Interceptor.php(140): Magento\Framework\View\Layout->renderElement('Uedakanamono_ba...', false)
#58 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement('Uedakanamono_ba...', false)
#59 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Layout.php(557): Magento\Framework\View\Layout->_renderContainer('left', false)
#60 F:\xampp\htdocs\magento2\generated\code\Magento\Framework\View\Layout\Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement('left')
#61 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('left')
#62 F:\xampp\htdocs\magento2\generated\code\Magento\Framework\View\Layout\Interceptor.php(140): Magento\Framework\View\Layout->renderElement('left', false)
#63 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Layout.php(606): Magento\Framework\View\Layout\Interceptor->renderElement('left', false)
#64 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Layout.php(557): Magento\Framework\View\Layout->_renderContainer('side.col', false)
#65 F:\xampp\htdocs\magento2\generated\code\Magento\Framework\View\Layout\Interceptor.php(149): Magento\Framework\View\Layout->renderNonCachedElement('side.col')
#66 F:\xampp\htdocs\magento2\lib\internal\Magento\Framework\View\Layout.php(510): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('side.col')
#67 F:\xampp\htdocs\magento2\generated\code\Magento\Framework\View\Layout\Interceptor.php(140): Magento\Framework\View\Layout->renderElement('side.col', false)
....
#102 {main} [] []

Who can answer this issue?

1
  • Hello Malcom, you are using explode function on null value plz use it in condition. Jul 3, 2023 at 10:28

1 Answer 1

0

Please update the below line in getValue() at Uedakanamono\BannerSlider\Block\Adminhtml\Banner\Chooser.php

$values = $this->getValue(); 

to

$values = $this->getValue() ?? '';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.