PHP code example of agence-adeliom / easy-fields-bundle

1. Go to this page and download the library: Download agence-adeliom/easy-fields-bundle 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/ */

    

agence-adeliom / easy-fields-bundle example snippets


use Adeliom\EasyFieldsBundle\Admin\Field\AssociationField;

// You have to add this form theme @EasyFields/form/association_widget.html.twig
...
yield AssociationField::new('property', "label");

use Adeliom\EasyFieldsBundle\Admin\Field\EnumField;
...
yield EnumField::new('property', "label")
    ->setEnum(YourEnumClass::class);

use Adeliom\EasyFieldsBundle\Admin\Field\FormTypeField;
...
yield FormTypeField::new('property', "label", YourFormTypeClass::class)

use Adeliom\EasyFieldsBundle\Admin\Field\TranslationField;

// You have to add this form theme @EasyFields/form/translations_widget.html.twig
...
yield TranslationField::new('property', "label", [
    'description' => [
        'field_type' => 'textarea',
        'label' => 'descript.',
        'locale_options' => [
            'es' => ['label' => 'descripción']
            'fr' => ['display' => false]
        ]
    ]
])

use Adeliom\EasyFieldsBundle\Admin\Field\ChoiceMaskField;

// You have to add this form theme @EasyFields/form/choice_mask_widget.html.twig
...
yield ChoiceMaskField::new('property', "label")
    ->setChoices([
        'uri' => 'uri',
        'route' => 'route',
    ])
    // Associative array. Describes the fields that are displayed for each choice.
    ->setMap([
        'route' => ['route', 'parameters'],
        'uri' => ['uri'],
    ]);

use Adeliom\EasyFieldsBundle\Admin\Field\SortableCollectionField;

// You have to add this form theme @EasyFields/form/sortable_widget.html.twig
...
// NOTE : property can be a *ToMany or an array.
yield SortableCollectionField::new('property', "label")
    ->setEntryType(YourEntryFromType::class)
    ->allowAdd() // Allow to add new entry
    ->allowDelete() // Allow to remove entries
    ->allowDrag()  // Allow to drag entries
    ;

use Adeliom\EasyFieldsBundle\Admin\Field\IconField;

// You have to add this form theme @EasyFields/form/icon_widget.html.twig
...
yield IconField::new('property', "label")
    ->setJsonUrl($url) // Must be a public json file with an array of your icon's classes
    ->setFonts($fonts) // Must be an array of yours fonticon css file
    ->setSelectButtonLabel() // Change label
    ->setCancelButtonLabel()  // Change label
    ->setShowAllButtonLabel()  // Change label
    ->setSearchPlaceholder()  // Change label
    ->setNotResultMessage()  // Change label
    ->setDeleteLabel()
    ;

use Adeliom\EasyFieldsBundle\Admin\Field\PositionSortableField;

// You have to add this form theme @EasyFields/form/form-easy-field-position-sortable.html.twig
...
yield PositionSortableField::new('property', "label");

use Adeliom\EasyFieldsBundle\Admin\Field\OembedField;

// You have to add this form theme @EasyFields/form/oembed_widget.html.twig
...
yield OembedField::new('property', "label");

# Get HTML code
{{ property|oembed_html }}

# Get Dimensions
{{ property|oembed_size }}