nucleartux
nucleartux

Reputation: 1400

sonata admin bundle: strange with labels

I've installed the latest Sonata admin bundle on symfony 2.1 and got the following problem: strange labels

config.yml:

services:
  app.geo.admin.city:
      class: App\GeoBundle\Admin\CityAdmin
      tags:
        - { name: sonata.admin, manager_type: orm, group: Гео данные, label: Города}
      arguments: [null, App\GeoBundle\Entity\City, SonataAdminBundle:CRUD]

Admin class:

class CityAdmin extends Admin
{
    public function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->add('name', null, array('required' => true))
            ->add('code')
            ->add('region')
            ->add('crest', 'file', array('required' => false))
            ->add('banner', 'file', array('required' => false))
            ->add('sort')
        ;
    }
}

Upvotes: 4

Views: 1231

Answers (1)

likeitlikeit
likeitlikeit

Reputation: 5638

That's a behaviour that I encountered as well a few weeks back. I think it disappeared after an update.

It usually makes sense to explicitly add labels to fields though, like so

$formMapper
    ->add('name', null, array('required' => true, 
            'label' => 'Lastname'
        ));

Upvotes: 1

Related Questions