This patch introduces a simple Twig filter that allows formatting a name directly within a template.
It leverages the NameFormatterInterface.

With this change, you can easily format name fields in templates without creating custom preprocess functions.

Example usage:
{{ entity.your_name_field.value[0]|format_name('your_custom_format') }}

What about it ?
Jo

CommentFileSizeAuthor
name-format_name_twigextension.patch1.44 KBjohaziel

Issue fork name-3553196

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

johaziel created an issue. See original summary.

bluegeek9 made their first commit to this issue’s fork.

bluegeek9’s picture

Status: Active » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support makes this project sustainable.
There are multiple ways to show appreciation for the work contributed to this project including:

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.