You are here

protected function EmailYamlFormHandler::getDefaultConfigurationValues in YAML Form 8

Get configuration default values.

Return value

array Configuration default values.

1 call to EmailYamlFormHandler::getDefaultConfigurationValues()
EmailYamlFormHandler::getDefaultConfigurationValue in src/Plugin/YamlFormHandler/EmailYamlFormHandler.php
Get configuration default value.

File

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

Class

EmailYamlFormHandler
Emails a form submission.

Namespace

Drupal\yamlform\Plugin\YamlFormHandler

Code

protected function getDefaultConfigurationValues() {
  if (isset($this->defaultValues)) {
    return $this->defaultValues;
  }
  $yamlform_settings = $this->configFactory
    ->get('yamlform.settings');
  $site_settings = $this->configFactory
    ->get('system.site');
  $body_format = $this->configuration['html'] ? 'html' : 'text';
  $default_mail = $yamlform_settings
    ->get('mail.default_to_mail') ?: $site_settings
    ->get('mail') ?: ini_get('sendmail_from');
  $this->defaultValues = [
    'to_mail' => $default_mail,
    'cc_mail' => $default_mail,
    'bcc_mail' => $default_mail,
    'from_mail' => $default_mail,
    'from_name' => $yamlform_settings
      ->get('mail.default_from_name') ?: $site_settings
      ->get('name'),
    'subject' => $yamlform_settings
      ->get('mail.default_subject') ?: 'Form submission from: [yamlform_submission:source-entity]',
    'body' => $this
      ->getBodyDefaultValues($body_format),
  ];
  return $this->defaultValues;
}