PHP code example of grossum / extended-form-type

1. Go to this page and download the library: Download grossum/extended-form-type library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

grossum / extended-form-type example snippets



// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Grossum\ExtendedFormTypeBundle\GrossumExtendedFormTypeBundle(),
        );

        // ...
    }

    // ...
}




// ...

class TestAdmin extends Admin
{

    /**
     * Fields to be shown on create/edit forms
     *
     * @param FormMapper $formMapper
     */
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            
            // ...
            
            ->add(
                'yourType',
                'grossum_dependent_filtered_entity',
                [
                    'entity_alias' => 'your_alias',
                    'empty_value'  => 'Select some value',
                    'parent_field' => 'test',
                    'label'        => 'Your label',
                ]
            )
            
            // ...
           
            ->end();
    }
    
     // ...
    
}