I'm trying to create a plugin for DirectoryDataProcessor.php
but I can't seem to get the di.xml
to work. The LayoutProcessor in di.xml
works.
I get the following error:
Plugin class BB\Checkout\Plugin\Block\DirectoryDataProcessorPlugin doesn't exist.
etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
<plugin name="bb_checkout" type="BB\Checkout\Plugin\Block\LayoutProcessor" sortOrder="1"/>
</type>
<type name="Magento\Checkout\Block\Checkout\DirectoryDataProcessor">
<plugin name='bb_checkout_req'
type='BB\Checkout\Plugin\Block\DirectoryDataProcessorPlugin'
sortOrder='99'/>
</type>
/BB/Checkout/Plugin/Block/DirectoryDataProcessorPlugin.php
<?php
namespace BB\Checkout\Plugin\Block\Checkout;
class DirectoryDataProcessorPlugin
{
/**
* @param \Magento\Checkout\Block\Checkout\DirectoryDataProcessor $subject
* @param array $jsLayout
* @return array
*/
public function afterProcess(
\Magento\Checkout\Block\Checkout\DirectoryDataProcessor $subject,
array $jsLayout
) {
return $jsLayout;
}
}
I tried changing the name and folder structure many times and have no clue on how to fix this. I just started working with Magento 2.
I also tried putting DirectoryDataProcessorPlugin in plugin/block instead of plugin/block/checkout.