Coder Social home page Coder Social logo

andersonamuller / easy-fields-bundle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from agence-adeliom/easy-fields-bundle

0.0 0.0 0.0 1.04 MB

A Symfony bundle for EasyAdmin that provide some fields

License: MIT License

JavaScript 76.17% PHP 15.27% CSS 1.27% Twig 7.29%

easy-fields-bundle's Introduction

Adeliom Quality gate

Easy Fields Bundle

Provide some fields for Easyadmin.

Versions

Repository Branch Version Symfony Compatibility PHP Compatibility Status
2.x 2.x 5.4, and 6.x 8.0.2 or higher New features and bug fixes
1.x 1.x 4.4, and 5.x 7.2.5 or higher No longer maintained

Installation with Symfony Flex

Add our recipes endpoint

{
  "extra": {
    "symfony": {
      "endpoint": [
        "https://api.github.com/repos/agence-adeliom/symfony-recipes/contents/index.json?ref=flex/main",
        ...
        "flex://defaults"
      ],
      "allow-contrib": true
    }
  }
}

Install with composer

composer require agence-adeliom/easy-fields-bundle

Documentation

AssociationField

Is an extension of EasyAdmin's AssociationField that allow you to create new object et select one from the curent page.

Usage

use Adeliom\EasyFieldsBundle\Admin\Field\AssociationField;

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

EnumField

Usage

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

FormTypeField

This field is a custom integration that allow you to bind any raw form type to your admin.

Usage

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

TranslationField

An A2lix TranslationFormBundle integration for EasyAdmin.

Usage

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]
        ]
    ]
])

ChoiceMaskField

An fork of Sonata's ChoiceMaskField for EasyAdmin.

Usage

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'],
    ]);

SortableCollectionField

Is an extension of EasyAdmin's CollectionField that allow you to sort entries.

Usage

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
    ;

IconField

Is an icon picker.

Usage

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()
    ;

PositionSortableField

Usage

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");

OembedField

To use this field, you need to add the bundle specific routes:

# config/routes/easy_fields.yaml

easy_fields:
  resource: '@EasyFieldsBundle/Resources/config/routes.xml'
  prefix: /

Usage

use Adeliom\EasyFieldsBundle\Admin\Field\OembedField;

// You have to add this form theme @EasyFields/form/oembed_widget.html.twig
...
yield OembedField::new('property', "label");
Twig render
# Get HTML code
{{ property|oembed_html }}

# Get Dimensions
{{ property|oembed_size }}

License

MIT

Authors

easy-fields-bundle's People

Contributors

arnaud-ritti avatar dependabot[bot] avatar jdadeliom avatar jeandaviddaviet avatar jeromeengeln avatar lucasvigneronadeliom avatar thibautzanca avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.