Piotr Synowiec
Piotr Synowiec
~1 min read

Categories

Tags

How to create simple and fast color picker for EasyAdmin.
No bundle no configuration just simple class and js library.

  • download the color picker jqColorPicker.min.js
  • create ColorPickerType class

  • Configure your field in EasyAdmin entity definition

      - { property: 'color', label: 'Color', type: 'App\Form\ColorPickerType' }
    
  • Overwrite you NEW & EDIT templates if required (example for edit)

  • For LIST & SHOW use template

  • and add template to you property

      - { property: 'rentChartColor', label: 'Color', sortable: false, template: 'admin/fields/color.html.twig' }
    
  • Result