Q
Q
Qixing2015-02-11 09:21:00
symfony
Qixing, 2015-02-11 09:21:00

How to use sonata admin formatter?

I want to use sonata formatter in the admin to edit the description field.
1) installed via composer
2) included in AppKernel
3) Added everything to the config
4) Then did additional actions according to here sonata-project.org/bundles/formatter/master/doc/re...
5) did install assets
As a result, in my builder

->add('description', 'sonata_formatter_type', array(
                    //'label' => 'Body',
                    'event_dispatcher' => $formMapper->getFormBuilder()->getEventDispatcher(),
                    'format_field' => 'description',
                    'source_field' => 'description',
                    'source_field_options' => array(
                        'attr' => array('class' => 'span10', 'rows' => 20)
                    ),
                    'error_bubbling' => false
                ));

I see a simple textarea . Everything is connected, JS scripts and styles too. I don't understand how to do it like in the example

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2015-02-11
@maxloyko

Oh, this sonata and its documentation ..
instead 'format_field' => 'description', close up something like that 'format_field' => 'formatType',and add it to the model

function getFormatType() {
        return '';
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question