0

I am using Magento2.4. In my phtml template, I am trying to escape an a argument that is being passed into a javascript file via requireJS, but PhpStorm is warning me that escapeJs() is depreciated. What would be the correct function to use if escapeJs() is depreciated?

1 Answer 1

1

In the block has $escaper already, you need to use that. Here is the example:

<?php
/**
 * @var \Magento\Framework\Escaper $escaper
 */
?>

Now you can use:

$escaper->escapeJs()
1
  • Thank you very much! Commented Oct 2, 2021 at 2:56

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.