Search code examples
phpsymfonysonata-adminsonata

Customise flash message of Sonata Admin


I'm using Sonata admin in my Symfony project. Users are stored in User entity and I have provided provision for users to manage their user details as their profile. When the profile is updated, the flash message looks like,

enter image description here

but the message looks odd to me. How can I change this message to something like Profile updated successfully? Is it possible to handle User related flash messages from UserAdmin class?

Any suggestion/solution will be helpful. Thanks in advance!!


Solution

  • I have overrided the translation file to change the flash messages which is common to all entity actions.

    I just copied SonataAdminBundle.en.xliff file from

    /vendor/sonata-project/admin-bundle/src/Resources/translations/

    and placed it in either src/Resources/SonataAdminBundle/translations or /translations and edit the messages as you wish.