Skip to content

Bundle with some useful form types for SonataAdminBundle (e.g. datepicker)

Notifications You must be signed in to change notification settings

ailove-dev/FormTypesBundle

Repository files navigation

How to install

Step 0: Modify deps

[FormTypesBundle]
    git=git://github.com/ailove-dev/FormTypesBundle.git
    target=/bundles/Ailove/FormTypesBundle

Step 1: Configure the Autoloader

Add a new namespace to your autoload

<?php
// app/autoload.php

$loader->registerNamespaces(array(
    // ...
    'Ailove' => __DIR__.'/../vendor/bundles',
));

Step 2: Enable the bundle

Finally, enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Ailove\FormTypesBundle\AiloveFormTypesBundle(),
    );
}

Step 4: Import twig fields template to your config.yml

twig:
    form:
        resources:
            - 'AiloveFormTypesBundle:Form:fields.html.twig'

Step 4: How to use form types

Datepicker

AdminClass:

FormFields

<?php
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ...
            ->add('startDate', 'sonata_type_datepicker', array('locale' => 'ru') )
            ...
        ;
    }

Filters

<?php
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
	$datagridMapper
	    ->add('startDate', 'doctrine_orm_datepicker', array(), 'sonata_type_datepicker', array('locale' => 'ru'))
	;
}

option locale represents localization value of jquery datepicker.

About

Bundle with some useful form types for SonataAdminBundle (e.g. datepicker)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages