You are here

public function DeclaredEmailManager::getDefinitions in Easy Email 8

Same name and namespace in other branches
  1. 2.0.x modules/easy_email_override/src/Service/DeclaredEmailManager.php \Drupal\easy_email_override\Service\DeclaredEmailManager::getDefinitions()

Gets the definition of all plugins for this type.

Return value

mixed[] An array of plugin definitions (empty array if no definitions were found). Keys are plugin IDs.

Overrides DefaultPluginManager::getDefinitions

See also

\Drupal\Core\Plugin\FilteredPluginManagerInterface::getFilteredDefinitions()

File

modules/easy_email_override/src/Service/DeclaredEmailManager.php, line 64

Class

DeclaredEmailManager
Manages discovery and instantiation of email plugins.

Namespace

Drupal\easy_email_override\Service

Code

public function getDefinitions() {
  $definitions = parent::getDefinitions();
  $definitions = array_filter($definitions, function ($definition) {
    return !empty($definition['module']) && $this->moduleHandler
      ->moduleExists($definition['module']);
  });
  foreach ($definitions as $i => $definition) {
    if (!empty($definition['params'])) {
      foreach ($definition['params'] as $param_id => $param) {
        if (!empty($param['label'])) {
          $definitions[$i]['params'][$param_id]['label'] = new TranslatableMarkup($definitions[$i]['params'][$param_id]['label']);
        }
      }
    }
  }
  return $definitions;
}