Type
magento2-module
The Messages module allows you to send success, notice, warning and error messages with HTML.
magento2-module
MIT
None
None
None
None
None
The Messages module allows you to send success, notice, warning and error messages with HTML.
composer require devtomic/magento2-module-messages
bin/magento module:enable Devtomic_Messages
bin/magento setup:upgrade
Call the addComplexSuccessMessage
function with the withHtml
identifier. This identifer expects two arguments:
html
: A string containing the desired HTMLallowed_tags
: An array containing a list of strings of HTML tags to allowThis code:
$this->messageManager->addComplexSuccessMessage(
'withHtml',
[
'html' => '<b>This is bold text!</b> And this is not.',
'allowed_tags' => ['b'],
]
);
Results in the following output: