File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -391,9 +391,18 @@ humanize
391391 ``text ``
392392 **type **: ``string ``
393393
394- Makes a technical name human readable (i.e. replaces underscores by spaces
395- or transforms camelCase text like ``helloWorld `` to ``hello world ``
396- and then capitalizes the string).
394+ Transforms the given string into a human readable string (by replacing underscores
395+ with spaces, capitalizing the string, etc.) It's useful e.g. when displaying
396+ the names of PHP properties/variables to end users:
397+
398+ .. code-block :: twig
399+
400+ {{ 'dateOfBirth'|humanize }} {# renders: Date of birth #}
401+ {{ 'DateOfBirth'|humanize }} {# renders: Date of birth #}
402+ {{ 'date-of-birth'|humanize }} {# renders: Date-of-birth #}
403+ {{ 'date_of_birth'|humanize }} {# renders: Date of birth #}
404+ {{ 'date of birth'|humanize }} {# renders: Date of birth #}
405+ {{ 'Date Of Birth'|humanize }} {# renders: Date of birth #}
397406
398407 .. _reference-twig-filter-trans :
399408
You can’t perform that action at this time.
0 commit comments