You are here

public function QueueService::getPluginsEnabled in Purge 8.3

Retrieve the configured plugin_ids that the service will use.

Return value

string[] Array with the plugin_ids of the enabled plugins.

Overrides ServiceBase::getPluginsEnabled

1 call to QueueService::getPluginsEnabled()
QueueService::initializeQueue in src/Plugin/Purge/Queue/QueueService.php
Initialize the transaction buffer and queue backend.

File

src/Plugin/Purge/Queue/QueueService.php, line 383

Class

QueueService
Provides the service that lets invalidations interact with a queue backend.

Namespace

Drupal\purge\Plugin\Purge\Queue

Code

public function getPluginsEnabled() {
  if (is_null($this->pluginsEnabled)) {
    $plugin_ids = array_keys($this
      ->getPlugins());
    $this->pluginsEnabled = [];

    // The queue service always interacts with just one underlying queue,
    // which is stored in configuration. By default, we use the DEFAULT_PLUGIN
    // or the FALLBACK_PLUGIN in case nothing else loads.
    $plugin_id = $this->configFactory
      ->get('purge.plugins')
      ->get('queue');
    if (is_null($plugin_id)) {
      $this->pluginsEnabled[] = self::DEFAULT_PLUGIN;
    }
    elseif (!in_array($plugin_id, $plugin_ids)) {
      $this->pluginsEnabled[] = self::FALLBACK_PLUGIN;
    }
    else {
      $this->pluginsEnabled[] = $plugin_id;
    }
  }
  return $this->pluginsEnabled;
}