I need to replace the method of getting the link this.getURL() with my custom method this.customMethod() in the confirmation email of the user during registration.
I have created a module:
registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'MyModules_Email',
__DIR__
);
etc/module.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<preference for="MagentoEmailModelAbstractTemplate" type="MyModulesEmailModelTest" />
</config>
etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MyModules_Email" setup_version="0.0.1">
<sequence>
<module name="Magento_Email"/>
</sequence>
</module>
</config>
Model/Test.php
<?php
namespace MyModulesEmailModel;
use MagentoStoreModelStore;
abstract class Test extends MagentoEmailModelAbstractTemplate
{
public function getUrlToStorefront(Store $store, $route = '', $params = [])
{
return 'test';
}
}
But when I try to use my method in a letter template, nothing happens, it doesn’t work, how can I fix this problem?