You are here

class TestMailSystemOverride in Sparkpost email 8.2

Example configuration override.

Hierarchy

Expanded class hierarchy of TestMailSystemOverride

2 string references to 'TestMailSystemOverride'
sparkpost.services.yml in ./sparkpost.services.yml
sparkpost.services.yml
TestMailSystemOverride::getCacheSuffix in src/TestMailSystemOverride.php
The string to append to the configuration static cache name.
1 service uses TestMailSystemOverride
sparkpost.test_mail_system_override in ./sparkpost.services.yml
\Drupal\sparkpost\TestMailSystemOverride

File

src/TestMailSystemOverride.php, line 12

Namespace

Drupal\sparkpost
View source
class TestMailSystemOverride implements ConfigFactoryOverrideInterface {

  /**
   * {@inheritdoc}
   */
  public function loadOverrides($names) {
    $overrides = [];
    if (in_array('system.mail', $names)) {

      // Use if default MailManager in use.
      $overrides['system.mail']['interface']['sparkpost_test_mail_form'] = 'sparkpost_mail';
    }
    if (in_array('mailsystem.settings', $names)) {

      // Use if mailsystem module is enabled.
      $overrides['mailsystem.settings']['modules']['sparkpost']['test_mail_form']['formatter'] = 'sparkpost_mail';
      $overrides['mailsystem.settings']['modules']['sparkpost']['test_mail_form']['sender'] = 'sparkpost_mail';
    }
    return $overrides;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheSuffix() {
    return 'TestMailSystemOverride';
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheableMetadata($name) {
    return new CacheableMetadata();
  }

  /**
   * {@inheritdoc}
   */
  public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
    return NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TestMailSystemOverride::createConfigObject public function Creates a configuration object for use during install and synchronization. Overrides ConfigFactoryOverrideInterface::createConfigObject
TestMailSystemOverride::getCacheableMetadata public function Gets the cacheability metadata associated with the config factory override. Overrides ConfigFactoryOverrideInterface::getCacheableMetadata
TestMailSystemOverride::getCacheSuffix public function The string to append to the configuration static cache name. Overrides ConfigFactoryOverrideInterface::getCacheSuffix
TestMailSystemOverride::loadOverrides public function Returns config overrides. Overrides ConfigFactoryOverrideInterface::loadOverrides