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.

  • Bro, Plugins are inherited. Magento\Framework\View\Result\Layout implements Magento\Framework\Controller\ResultInterface – Aditya Shah Oct 10 '18 at 11:01
  • Try this code... – Aditya Shah Oct 10 '18 at 11:02
  • <type name="Magento\Framework\Controller\ResultInterface"> <plugin name="custom_layout_load" type="<Vendor>\<Module>\Plugin\CustomLayout" /> </type> – Aditya Shah Oct 10 '18 at 11:03
  • /vendor/magento/framework/View/Result/Layout.php – Aditya Shah Oct 10 '18 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 – Dharmendra Jadav Oct 10 '18 at 11:12
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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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