petkopara / PetkoparaCrudGeneratorBundle

Symfony3 CRUD generator bundle with pagination, filter, bulk actions and Twitter bootstrap 3.3.6 features.
MIT License
70 stars 17 forks source link

Adds new _title_ parameter to the th_sortable macro. #48

Closed davidpeoples closed 7 years ago

davidpeoples commented 7 years ago

Column titles in the index page table can now be set to any arbitrary value, not just the entity's field name.

This change alters the th_sortable.html.twig macro by adding an optional 5th parameter "title". If title is set, it will be used for the column header text in sortable columns. If unset, the macro will use the colName parameter (capitalized), which was the original macro behavior.

Since the macro uses its original behavior if the 5th parameter is unset, it is safe to use this version of the macro with twig templates that were created with an older version of the generator.

The index.html.twig.twig generator template is altered to call the macro with all 5 parameters, The new title parameter is set to a capitalized version of the field name in the default generated index.html.twig. So unless the generated twig template is edited after generation, the resulting column labels are the same as they would have been before this change was merged. However now there is the option to edit the generated template to change the labels to something more desirable.