Symfony2 Sonata Admin show attribute only as a readyonly text

前端 未结 2 1715
野性不改
野性不改 2021-02-05 21:41

I have some immutable attributes on my entity to administrate with sonata-admin bundle.

I want to show them in the edit-view of the entity, but don\'t want to provide an

相关标签:
2条回答
  • 2021-02-05 22:24
    $formMapper
        ->add('post', 'entity', 
            array(
                'label' => 'Some post',
                'read_only' => true,
                'disabled'  => true,
                'class' => 'Acme\DemoBundle\Entity\Post'
            )
        )
    ;
    
    0 讨论(0)
  • 2021-02-05 22:24

    This answer tells how to customize list rendering. Maybe the same approach works with form rendering?

    If not, then you can create your custom form type according to create custom field type documentation, and customizing the template.

    0 讨论(0)
提交回复
热议问题