Chris@0: $start) { Chris@0: $has_psr3 = TRUE; Chris@0: // Transform PSR3 style messages containing placeholders to Chris@17: // \Drupal\Component\Render\FormattableMarkup style. Chris@0: $message = preg_replace('/\{(.*)\}/U', '@$1', $message); Chris@0: } Chris@0: foreach ($context as $key => $variable) { Chris@0: // PSR3 style placeholders. Chris@0: if ($has_psr3) { Chris@0: // Keys are not prefixed with anything according to PSR3 specs. Chris@0: // If the message is "User {username} created" the variable key will be Chris@0: // just "username". Chris@0: if (strpos($message, '@' . $key) !== FALSE) { Chris@0: $key = '@' . $key; Chris@0: } Chris@0: } Chris@0: if (!empty($key) && ($key[0] === '@' || $key[0] === '%' || $key[0] === '!')) { Chris@17: // The key is now in \Drupal\Component\Render\FormattableMarkup style. Chris@0: $variables[$key] = $variable; Chris@0: } Chris@0: } Chris@0: Chris@0: return $variables; Chris@0: } Chris@0: Chris@0: }