You are here

public function CourierTokenElementTrait::templateCollectionTokenElement in Courier 8

Same name and namespace in other branches
  1. 2.x src/CourierTokenElementTrait.php \Drupal\courier\CourierTokenElementTrait::templateCollectionTokenElement()

Render a token element for a template collection.

Parameters

\Drupal\courier\TemplateCollectionInterface $template_collection: A template collection entity.

Return value

array A render array.

See also

::courierTokenElement().

2 calls to CourierTokenElementTrait::templateCollectionTokenElement()
ChannelFormController::tokens in src/Controller/ChannelFormController.php
Get tokens for a template collection.
EmailForm::form in src/Form/EmailForm.php
Gets the actual form array to be built.

File

src/CourierTokenElementTrait.php, line 29
Contains \Drupal\courier\CourierTokenElementTrait.

Class

CourierTokenElementTrait
Defines a trait for adding a token element based on available tokens for a template collection.

Namespace

Drupal\courier

Code

public function templateCollectionTokenElement(TemplateCollectionInterface $template_collection) {
  $tokens = ($context = $template_collection
    ->getContext()) ? $context
    ->getTokens() : [];
  return $this
    ->courierTokenElement($tokens);
}