---
title: "Flash messages in Extbase"
manual: "TYPO3 Explained"
version: "13.4"
permalink: "https://docs.typo3.org/permalink/t3coreapi:flash-messages-extbase@13.4"
source: "ApiOverview/FlashMessages/Extbase.rst"
rendered: "2026-09-18T05:52:58+00:00"
---

# Flash messages in Extbase {#flash-messages-in-extbase}

In Extbase, the standard way of issuing flash messages is to add them
in the controller. Code from the ["examples" extension](https://github.com/TYPO3-Documentation/t3docs-examples):

**EXT:examples/Classes/Controller/ModuleController.php**

```php
$this->addFlashMessage('This is a simple success message');
```

> [!WARNING]
> You cannot call this function in the constructor of a controller
> or in an initialize action as it needs some internal data
> structures to be initialized.

A more elaborate example:

**EXT:examples/Classes/Controller/ModuleController.php**

```php
// use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;

$this->addFlashMessage(
   'This message is forced to be NOT stored in the session by setting the fourth argument to FALSE.',
   'Success',
   ContextualFeedbackSeverity::OK,
   false
);
```

The messages are then displayed by Fluid with the
[FlashMessages ViewHelper \<f:flashMessages>](https://docs.typo3.org/other/typo3/view-helper-reference/13.4/en-us/Global/FlashMessages.html#typo3-fluid-flashmessages):

**EXT:my_extension/Resources/Private/Templates/SomeTemplate.fluid.html**

```html
<div id="typo3-docbody">
   <div id="typo3-inner-docbody">
      <f:flashMessages />
      <f:render section="main" />
   </div>
</div>
```

Where to display the flash messages in an Extbase-based backend module is
as simple as moving the ViewHelper around.

By default, all messages are put into the scope of the
current plugin namespace with a prefix `extbase.flashmessages.`. So
if your plugin namespace is computed as `tx_myvendor_myplugin`, the
flash message queue identifier will be
`extbase.flashmessages.tx_myvendor_myplugin`.

## Using explicit flash message queues in Extbase {#using-explicit-flash-message-queues-in-extbase}

It is possible to add a message to a different flash message queue. Use
cases could be a detailed display of different flash message queues in
different places of the page  or displaying a flash message when you
forward to a different controller or even a different extension.

If you need distinct queues, you can use a custom identifier to fetch
and operate on that queue:

**EXT:examples/Classes/Controller/ModuleController.php (excerpt)**

```php
$customQueue = $this->getFlashMessageQueue('tx_myvendor_customqueue');
// Instead of using $this->addFlashMessage() you will instead directly
// access the custom queue:
$flashMessage = GeneralUtility::makeInstance(
        FlashMessage::class,
        'My flash message in a custom queue',
        'My flash message title of a custom queue',
        ContextualFeedbackSeverity::OK,
        $storeInSession = true,
);
$customQueue->enqueue($flashMessage);
```

## Fluid flash messages ViewHelper with explicit queue identifier {#fluid-flash-messages-viewhelper-with-explicit-queue-identifier}

When you used an [explicit flash message queue](https://docs.typo3.org/permalink/t3coreapi:flash-messages-extbase-distinct@13.4)
during enqueueing the message, it will only be displayed on the page if you use the
same identifier in the [FlashMessages ViewHelper \<f:flashMessages>](https://docs.typo3.org/other/typo3/view-helper-reference/13.4/en-us/Global/FlashMessages.html#typo3-fluid-flashmessages).

```html
<f:flashMessages queueIdentifier="tx_myvendor_customqueue" />
```
