Validation and messages · Question 9 of 12

A backend module without Extbase should show the message "Saved" after saving. How do you create it?

1 answer is correct. Medium

Show answer

Answer

  • C Create a FlashMessage with ContextualFeedbackSeverity::OK and enqueue it into the default queue via FlashMessageService::getMessageQueueByIdentifier()

Explanation

addFlashMessage() belongs to the Extbase ActionController. Without Extbase, you get the FlashMessageService via dependency injection, call getMessageQueueByIdentifier() without an argument (default queue core.template.flashMessages) and pass the message with enqueue() or addMessage(). If it should survive a redirect, set storeInSession to true when creating it. If the module works with the ModuleTemplate, $view->addFlashMessage() is shorter and uses the same queue.

Certifications & exams

Which exam comes next?

You can already practise for 19 exams, and 21 are up for a vote. See all certifications with their official information, cast your vote or suggest your exam.

See all certifications