Skip to content

How to override magentoframeworkviewpageconfig.php file in magento 2 for removing htmlentites in page source code

I want to override the magentoframeworkviewpageconfig.php file setMetadata($name, $content) method to remove the htmlentites in meta description when we are viewing the page source code.

For that i did following code

di.xml file:

    <preference for="vendormagentoframeworkViewPageConfig" type="LogoImporterFrameworkViewPageConfig" />

LogoImporterFrameworkViewPageConfig.php file:

<?php
namespace LogoImporterFrameworkViewPage;

class Config extends MagentoFrameworkViewPageConfig
{
    public function setMetadata($name, $content)
    {
        $this->build();
        $this->metadata[$name] = htmlspecialchars($content);
    }
    
}

But its still not removing the htmlentities from page source code.

Any help can be appreciated.

Thanks!