Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages in full color showing how to combine Symfony with Docker, APIs, queues & async tasks, Webpack, Single-Page Applications, etc.

Buy printed version

2. iCheck

4.x version
Maintained

2. iCheck

The admin comes with iCheck integration since version 3.0.0. iCheck is a jQuery based checkbox and radio buttons skinning plugin. It provides a cross-browser and accessible solution to checkboxes and radio buttons customization.

The iCheck plugin is enabled on all checkbox and radio form elements by default.

2.1. Disable iCheck

If you don’t want to use iCheck in your admin, you can disable it in configuration.

  • YAML
    1
    2
    3
    4
    5
    # config/packages/sonata_admin.yaml
    
    sonata_admin:
        options:
            use_icheck: false # disable iCheck
    

2.2. Disable iCheck on some form elements

To disable iCheck on some checkbox or radio form elements, set data attribute data-sonata-icheck = "false" to this form element:

use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Form\Type\ModelType;

public function configureFormFields(FormMapper $formMapper)
{
    $formMapper
        ->add('category', ModelType::class, [
            'attr' => [
                'data-sonata-icheck' => 'false'
            ]
        ])
    ;
}

Note

You have to use false as string! "false"!

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.