Posted on

Directory of custom block in magento 2.1

I create a file custom block php.

Directory is: appdesignfrontendVendordefaultMagento_ThemeBlockCustomBlock.php


class CustomBlock extends MagentoFrameworkViewElementTemplate
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
MagentoStoreModelInformation $storeInfo,
array $data = []
$this->_storeInfo = $storeInfo;
parent::__construct($context, $data);

Define block xml:

<block class=”MagentoThemeBlockCustomBlock” name=”…”>
<argument name=”template” xsi:type=”string”>Magento_Theme::html/footer/footer.phtml</argument>

But I get an exception:

Exception #0 (MagentoFrameworkExceptionLocalizedException): Invalid block type: MagentoThemeBlockCustomBlock
Exception #1 (ReflectionException): Class MagentoThemeBlockCustomBlockdoes not exist

Please help me!

Leave a Reply

Your email address will not be published. Required fields are marked *