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?

Piyush
5,9249 gold badges35 silver badges67 bronze badges
asked Jul 6, 2018 at 6:35

1 Answer 1

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

answered Jul 6, 2018 at 6:37
1
  • That's most satisfying answer. Hats off Commented Jul 6, 2018 at 8:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.