You are here

protected function EmailYamlFormHandler::getBodyDefaultValues in YAML Form 8

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 EmailYamlFormHandler::getBodyDefaultValues()
EmailYamlFormHandler::buildConfigurationForm in src/Plugin/YamlFormHandler/EmailYamlFormHandler.php
Form constructor.
EmailYamlFormHandler::getDefaultConfigurationValues in src/Plugin/YamlFormHandler/EmailYamlFormHandler.php
Get configuration default values.

File

src/Plugin/YamlFormHandler/EmailYamlFormHandler.php, line 722

Class

EmailYamlFormHandler
Emails a form submission.

Namespace

Drupal\yamlform\Plugin\YamlFormHandler

Code

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