You are here

public function SettingsForm::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/aggregator/src/Form/SettingsForm.php \Drupal\aggregator\Form\SettingsForm::__construct()

Constructs a \Drupal\aggregator\SettingsForm object.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The factory for configuration objects.

\Drupal\aggregator\Plugin\AggregatorPluginManager $fetcher_manager: The aggregator fetcher plugin manager.

\Drupal\aggregator\Plugin\AggregatorPluginManager $parser_manager: The aggregator parser plugin manager.

\Drupal\aggregator\Plugin\AggregatorPluginManager $processor_manager: The aggregator processor plugin manager.

\Drupal\Core\StringTranslation\TranslationInterface $string_translation: The string translation manager.

Overrides ConfigFormBase::__construct

File

core/modules/aggregator/src/Form/SettingsForm.php, line 60

Class

SettingsForm
Configures aggregator settings for this site.

Namespace

Drupal\aggregator\Form

Code

public function __construct(ConfigFactoryInterface $config_factory, AggregatorPluginManager $fetcher_manager, AggregatorPluginManager $parser_manager, AggregatorPluginManager $processor_manager, TranslationInterface $string_translation) {
  parent::__construct($config_factory);
  $this->stringTranslation = $string_translation;
  $this->managers = [
    'fetcher' => $fetcher_manager,
    'parser' => $parser_manager,
    'processor' => $processor_manager,
  ];

  // Get all available fetcher, parser and processor definitions.
  foreach ([
    'fetcher',
    'parser',
    'processor',
  ] as $type) {
    foreach ($this->managers[$type]
      ->getDefinitions() as $id => $definition) {
      $this->definitions[$type][$id] = new FormattableMarkup('@title <span class="description">@description</span>', [
        '@title' => $definition['title'],
        '@description' => $definition['description'],
      ]);
    }
  }
}