User tests: Successful: Unsuccessful:
When extending the MailTemplate class with my own implementation to override the getTemplate(...) method. The send(...) method is still using the original method.
Create the file libraries/src/Mail/MailTemplateExtended.php with the following code:
<?php
namespace Joomla\CMS\Mail;
\defined('_JEXEC') or die;
class MailTemplateExtended extends MailTemplate
{
public static function getTemplate($key, $language)
{
exit('hello world');
}
}
$mailtemplate = new MailTemplateExtended('com_messages.new_message', 'en-GB');
$mailtemplate->addRecipient('test@example.com');
$mailtemplate->send();
The old getTemplate is called.
The script stops with "hello world", which means, the new method is called.
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
I have tested this item ✅ successfully on 58b5996
| Status | Pending | ⇒ | Ready to Commit |
RTC
| Title |
|
||||||
I have tested this item ✅ successfully on 58b5996
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46448.