1

Symfony has an EntityType field that allows a <select> field to be automatically populated by rows in a table. Going further, these rows can be categorized into <optgroup> clusters if the group_by option is given a property path.

Example:

$builder->add('categories', EntityType::class, [
        'class'        => PostCategory::class,
        'group_by'     => 'column_name',
        'mapped'       => FALSE,
    ]);

Given this code snippet, how would I change the rendered <optgroup> text? For example, how would I humanize (e.g. capitalize) it?

Nathanael
  • 6,893
  • 5
  • 33
  • 54
  • 2
    Probably not the simple answer you are looking for, but you could always do a custom rendering of your form. See [here](https://stackoverflow.com/a/9176223/546262) for an example. – ehymel Sep 09 '18 at 00:01

0 Answers0