2

When templates hints are turned ON , it is shown that

Magento\Checkout\Block\Cart\Sidebar\Interceptor

is responsible for

/var/www/html/magento/vendor/magento/module-checkout/view/frontend/templates/cart/minicart.phtml

when I browsed to the loaction

/vendor/magento/module-checkout/Block/Cart

There is Sidebar.php

Not Sidebar/Interceptor.php, which is expected from the block name conventions followed by magento.

Where can I find the file?

Also In which layout file the minicart.phtml file is defined?

3

The classes that end with Interceptor, Proxy and Factory (but not all of them) may be found in generated/code folder.
They all look very similar.
But please don't change them because they get regenerated.

You will see that all Interceptor classes have the following characteristics:

They extend a class with the same as the current class except there is a missing "interceptor" at the end.
All methods in the interceptor look like this:

public function methodNameHere(parameters here)
{
    $pluginInfo = $this->pluginList->getNext($this->subjectType, 'methodNameHere');
    if (!$pluginInfo) {
        return parent::methodNameHere(parameters here);
    } else {
        return $this->___callPlugins('methodNameHere', func_get_args(), $pluginInfo);
    }
}

This is a method to change the behavior of a function without changing the function itself.
Read more about code generation and plugins

  • That's most satisfying answer. Hats off – shabeeb ali Jul 6 '18 at 8:56

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.