Version

Documentation » Core

3. Form Types »

« Core Bundle

1. Installation

1.1. Download the Bundle

composer require sonata-project/core-bundle

1.2. Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in bundles.php file of your project:

// config/bundles.php

return [
    // ...
    Sonata\CoreBundle\SonataCoreBundle::class => ['all' => true],
];

2. Configuration

  • YAML
    # config/packages/sonata_core.yaml
    
    sonata_core:
        form:
            mapping:
                enabled: false
    

When using bootstrap, some widgets need to be wrapped in a special div element depending on whether you are using the standard style for your forms or the horizontal style.

If you are using the horizontal style, you will need to configure the corresponding configuration node accordingly:

  • YAML
    # config/packages/sonata_core.yaml
    
    sonata_core:
        form_type: horizontal
    

Note

Please note that if you are using SonataAdminBundle, this is actually optional:

The SonataCoreBundle extension will detect if the configuration node that deals with the form style in the admin bundle is set and will configure the core bundle for you.

Found a typo? Something is wrong in this documentation? Just fork and edit it!