Skip to content

Instantly share code, notes, and snippets.

@LucasCalazans
Last active August 1, 2018 22:55
Show Gist options
  • Save LucasCalazans/4dcf0075cad09fa573d75a0a200d5eb7 to your computer and use it in GitHub Desktop.
Save LucasCalazans/4dcf0075cad09fa573d75a0a200d5eb7 to your computer and use it in GitHub Desktop.
Simulate Magento messages, useful to front-enders.
<?php
// Edit the follow file: vendor/magento/framework/App/Action/Action.php
public function __construct(Context $context)
{
// ... //
$this->messageManager->addError(__('Error message.'));
$this->messageManager->addSuccessMessage(__('Success message.'));
$this->messageManager->addWarning(__('Warning message.'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment