You are here

public function EventTemplate::asString in MongoDB 8.2

Returns the message with its variables substituted into it.

This code passes a variable to $this->t() because the "variable" ultimately comes from a module code, not from user input. This assumes modules correctly pass only template messages to PSR-3 methods, instead of already assembled messages.

XXX babysit broken modules using messages containing user input.

This code disables coding standards because the module relies on translated event templates, which are known to be variable but - assuming no coding errors - will always match a constant event template string found in code.

Parameters

array $variables: The event variables.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The template message with its variables substituted.

File

modules/mongodb_watchdog/src/EventTemplate.php, line 154

Class

EventTemplate
Class EventTemplate models an event template.

Namespace

Drupal\mongodb_watchdog

Code

public function asString(array $variables) : TranslatableMarkup {

  // @codingStandardsIgnoreStart
  return $this
    ->t($this->message, $variables);

  // @codingStandardsIgnoreEnd
}