Skip to content


From magento 2.4 the escape method has changed.

Instead of doing this:

We instead use:
This is because the escape methods of blocks has been deprecated and instead replaced with direct calls to the Escaper class.

For code completion we include a new use statement in phtml files.

use Magento\Framework\Escaper;

/** @var Escaper $escaper */

Magento Docs