You are here

protected function EmailWebformHandler::getBodyDefaultValues in Webform 6.x

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

Get message body default values, which can be formatted as text or html.

Parameters

string $format: If a format (text or html) is provided the default value for the specified format is return. If no format is specified an associative array containing the text and html default body values will be returned.

Return value

string|array A single (text or html) default body value or an associative array containing both the text and html default body values.

2 calls to EmailWebformHandler::getBodyDefaultValues()
EmailWebformHandler::buildConfigurationForm in src/Plugin/WebformHandler/EmailWebformHandler.php
Form constructor.
EmailWebformHandler::getDefaultConfigurationValues in src/Plugin/WebformHandler/EmailWebformHandler.php
Get configuration default values.

File

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

Class

EmailWebformHandler
Emails a webform submission.

Namespace

Drupal\webform\Plugin\WebformHandler

Code

protected function getBodyDefaultValues($format = NULL) {
  $webform_settings = $this->configFactory
    ->get('webform.settings');
  $formats = [
    'text' => $webform_settings
      ->get('mail.default_body_text') ?: '[webform_submission:values]',
    'html' => $webform_settings
      ->get('mail.default_body_html') ?: '[webform_submission:values]',
  ];
  return $format === NULL ? $formats : $formats[$format];
}