In 2.3.6, the following line was added to form.mini.phtml:
$configProvider = $block->getData('configProvider');
Since the upgrade, this returns null and causes a fatal error due to this subsequent call on the null object:
$configProvider->isSuggestionsAllowed()
"Uncaught Error: Call to a member function isSuggestionsAllowed() on null"
My site uses a custom module that adds notices during shipping and checkout using blocks. This module is causing the fatal error, but it shouldn't have anything to do with the search block.
I need to change the module di.xml file or custom class to return a configProvider for search, or tell it to use the default class. Can anyone point me the right direction? Many thanks.
Here is my code:
/app/code/Port80/CIBC/etc/frontend/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Checkout\Model\CompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="cms_block_config_provider" xsi:type="object">Port80\CIBC\Model\ConfigProvider</item>
</argument>
</arguments>
</type>
<preference for="Magento\Customer\Model\Vat" type="Port80\CIBC\Model\Customer\Vat" />
</config>
/app/code/Port80/CIBC/Model/ConfigProvider.php
use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Framework\View\LayoutInterface;
class ConfigProvider implements ConfigProviderInterface
{
/** @var LayoutInterface */
protected $_layout;
public function __construct(LayoutInterface $layout)
{
$this->_layout = $layout;
}
public function getConfig()
{
return [
'payment_notices' => $this->_layout->createBlock('Magento\Cms\Block\Block')->setBlockId('checkout_payment_notices')->toHtml(),
'shipping_notices' => $this->_layout->createBlock('Magento\Cms\Block\Block')->setBlockId('checkout_shipping_notices')->toHtml()
];
}
}