You are here

protected function EmailWebformHandler::getElementKeyFromToken in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformHandler/EmailWebformHandler.php \Drupal\webform\Plugin\WebformHandler\EmailWebformHandler::getElementKeyFromToken()

Get element key from webform token.

Parameters

string $token: The token.

string $format: The element format.

Return value

string|null The element key or NULL if token can not be parsed.

2 calls to EmailWebformHandler::getElementKeyFromToken()
EmailWebformHandler::buildElement in src/Plugin/WebformHandler/EmailWebformHandler.php
Build A select other element for email address and names.
EmailWebformHandler::getMessageEmails in src/Plugin/WebformHandler/EmailWebformHandler.php
Get message to, cc, bcc, and from email addresses.

File

src/Plugin/WebformHandler/EmailWebformHandler.php, line 1700

Class

EmailWebformHandler
Emails a webform submission.

Namespace

Drupal\webform\Plugin\WebformHandler

Code

protected function getElementKeyFromToken($token, $format = 'raw') {
  if (preg_match('/^\\[webform_submission:values:([^:]+):' . $format . '\\]$/', $token, $match)) {
    return $match[1];
  }
  else {
    return NULL;
  }
}