简体   繁体   中英

Symfony2 Sonata Admin shows text after creating a new item

First, i'm sorry for my bad english,

im using sonata-admin bundle, and adminstrating my own Entity, when i'm creating a new item I have a block of text (the text that i write in the first input) that appears in the top of the Admin page, and it's ugly when its a big paragraph.

Lets say my first input is "Content", so when I write "

This is my content

" and save the item, it says "The item "

This is my content

" has been created succefully", how can I make another input be written in the success message

EDIT :

Here is a printscreen :

在此处输入图片说明

  $formMapper ->add('page_mere1', 'choice', array('label' => 'Page mère 1', 'choices' => array('Podologie' => 'Podologie', 'Podz Pro'=>'Podz Pro'))) ->add('page_mere2', 'choice', array('label' => 'Page mère 2', 'choices' => array('Pathologies' => 'Pathologies', 'Maladies spécifiques'=>'Maladies spécifiques'))) ->add('page_mere3', 'choice', array('label' => 'Page mère 3', 'choices' => array('Pied' => 'Pied', 'Cheville'=>'Cheville', 'Jambe'=>'Jambe', 'Genou'=>'Genou', 'Hanche'=>'Hanche', 'Dos'=>'Dos'))) ->add('translations', 'a2lix_translations_gedmo', array( 'translatable_class' => "Antipodes\\SiteBundle\\Entity\\Pathologie", 'fields' => array( 'titre' => array( 'field_type' => null, 'required' => false, 'label' => 'Titre.', 'locale_options' => array( 'fr' => array( 'label' => 'Titre' ), 'en' => array( 'label' => 'Title' ) ) ), 'Definition' => array( 'field_type' => null, 'required' => false, 'label' => 'Definition.', 'locale_options' => array( 'fr' => array( 'label' => 'Definition' ), 'en' => array( 'label' => 'Definition' ) ) ), ) )) ; //....... 

Thanks in advance

I'm not sure if I'm understanding you correctly, but if you want to change the OK flashbag message after an successful edit you can do this with the _toString() method in your entity.

Open your Pathologie entity and add/edit the __toString() function, example:

public function __toString() {
    return $this->titre;
}

The save-flashbag would then merge the "titre"-value instead of "Definition"-value into the message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM