0

I have update one my extension to the marketplace.

But I am getting error “Class doesn't exist” error but my class is already there.

My di.xml is below.

<type name="Magento\Framework\View\Result\Layout">
        <plugin name="custom_layout_load" type="<Vendor>\<Module>\Plugin\CustomLayout" />
    </type>

My Plugin CustomLayout.php is below.

<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
namespace <Vendor>\<Module>\Plugin;

use Magento\Framework\View\Result\Layout;
/**
 * Description of SalesFormLayout
 *
 * @author dharmendra
 */
class CustomLayout
{
    const CUSTOM_LAYOUT_HANDLE = 'custome_layout';
    /**
     * @var \Magento\Framework\App\Request\Http
     */
    private $request;

    /**
     * LayoutPlugin constructor.
     * @param \Magento\Framework\App\Request\Http $request
     */
    public function __construct(
        \Magento\Framework\App\Request\Http $request
    ) {
        $this->request = $request;
    }

    /**
     * @param Layout $layout
     * @param $response
     * @return bool
     */
    public function afterAddDefaultHandle(Layout $layout, $response)
    {
        $fullActionName = $this->request->getFullActionName();
        if ($fullActionName == 'layout_action') {
            $layout->addHandle(self::CUSTOM_LAYOUT_HANDLE);
        }
        return $response;
    }
}

Still Marketplace throw error class doesn't exist. I will stuck with the issue if any one know the solution please give.

Thanks in advance.

10
  • Bro, Plugins are inherited. Magento\Framework\View\Result\Layout implements Magento\Framework\Controller\ResultInterface Commented Oct 10, 2018 at 11:01
  • Try this code... Commented Oct 10, 2018 at 11:02
  • <type name="Magento\Framework\Controller\ResultInterface"> <plugin name="custom_layout_load" type="<Vendor>\<Module>\Plugin\CustomLayout" /> </type> Commented Oct 10, 2018 at 11:03
  • /vendor/magento/framework/View/Result/Layout.php Commented Oct 10, 2018 at 11:05
  • Issue is not that which class inherited. But issue is that Class doesn't exist but I have that class define and it's working with local Commented Oct 10, 2018 at 11:12

1 Answer 1

0

I think you need to run below commands to regenerate class.

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

php bin/magento setup:di:compile

php bin/magento cache:flush

php bin/magento cache:clean

4

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.