Problem/Motivation

When i was configuring my project to handle CM Notifications, i needed to provide a dynamic email sender.
To do so, i had to find the right twig variables to achieve my goal.

Proposed resolution

Add the table below into readme in order to help other users to easily find those most useful tokens

USEFUL TWIG VARIABLES
---------------------

The most commonly used Twig variables for notifications are:

Current User Email:                       {{ user.email }}
Current User Username (the login name):   {{ user.username }}
Current User DisplayName:                 {{ user.displayname }}
Current User ID (uid):                    {{ user.id }}

Author Email:                             {{ entity.Owner.mail.0.value }}
Author Username (the login name):         {{ entity.Owner.username }}
Author DisplayName:                       {{ entity.Owner.displayname }}
Author id (uid):                          {{ entity.Owner.id }}

Entity Title:                             {{ entity.title.value }}
Entity Bundle (Content type system name): {{ entity.bundle }}
Entity Bundle Label (Content type name):  {{ entity.type.entity.label }}
Entity ID:                                {{ entity.nid.value }}
Entity Revision:                          {{ entity.vid.value }}
Entity UUID:                              {{ entity.uuid.value }}
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

igorgoncalves created an issue. See original summary.

igorgoncalves’s picture

Issue tags: +Novice
danrod’s picture

Assigned: Unassigned » danrod

danrod’s picture

I created a MR to add this table.

I suggest to replace the README.txt with a README.md and follow the template guidelines: https://www.drupal.org/docs/develop/managing-a-drupalorg-theme-module-or...

but this is out of scope of this issue, I'll create another issue to address that.

danrod’s picture

Assigned: danrod » Unassigned
Status: Active » Needs review
igorgoncalves’s picture

Thanks danrod!

Looks good to me.

igorgoncalves’s picture

Status: Needs review » Reviewed & tested by the community

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

bkosborne’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all. Some of those twig vars are incorrect though. I updated them before committing.

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

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

Maintainers, please credit people who helped resolve this issue.

  • bkosborne committed ee20d55c on 8.x-3.x authored by danrod
    [#3522215] task: Add useful twig variables to README
    
    By: igorgoncalves...

Status: Fixed » Closed (fixed)

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