/** * 2016-08-02 * An arbitrary non-existent identifier allows to preserve the HTML tags in the message. * @see \Magento\Framework\View\Element\Message\InterpretationMediator::interpret() * https://github.com/magento/magento2/blob/2.1.0/lib/internal/Magento/Framework/View/Element/Message/InterpretationMediator.php#L26-L43 * @param string|Phrase $text * @param string $type * @return void */ function df_message_add($text, $type) { /** @var IMessage $message */ $message = df_message_m()->createMessage($type, 'non-existent'); $message->setText(df_phrase($text)); df_message_m()->addMessage($message, null); }
/** * 2016-07-14 * Сообщение показывается всего на 5 секунд, а затем скрывается: https://mage2.pro/t/1871 * @param string|Phrase $text * @param bool $success * @return void */ function df_checkout_message($text, $success) { /** @var array(array(string => bool|Phrase)) $messages */ $messages = df_checkout_session()->getDfMessages(); /** * 2016-07-14 * @used-by https://github.com/mage2pro/core/blob/539a6c4/Checkout/view/frontend/web/js/messages.js?ts=4#L17 */ $messages[] = ['text' => df_phrase($text), 'success' => $success]; df_checkout_session()->setDfMessages($messages); }