You are here

protected function EmailOverrideForm::getEmailDefaultValue in Easy Email 8

Same name and namespace in other branches
  1. 2.0.x modules/easy_email_override/src/Form/EmailOverrideForm.php \Drupal\easy_email_override\Form\EmailOverrideForm::getEmailDefaultValue()

Return value

string|null

1 call to EmailOverrideForm::getEmailDefaultValue()
EmailOverrideForm::form in modules/easy_email_override/src/Form/EmailOverrideForm.php
Gets the actual form array to be built.

File

modules/easy_email_override/src/Form/EmailOverrideForm.php, line 75

Class

EmailOverrideForm
Class EmailOverrideForm.

Namespace

Drupal\easy_email_override\Form

Code

protected function getEmailDefaultValue() {
  $default_value = NULL;

  /** @var \Drupal\easy_email_override\Entity\EmailOverrideInterface $easy_email_override */
  $easy_email_override = $this->entity;
  $module = $easy_email_override
    ->getModule();
  $key = $easy_email_override
    ->getKey();
  if (!empty($module) && !empty($key)) {
    $definitions = $this->emailManager
      ->getDefinitions();
    foreach ($definitions as $id => $definition) {
      if ($definition['module'] === $module && $definition['key'] === $key) {
        $default_value = $id;
        break;
      }
    }
  }
  return $default_value;
}