You are here

public function UserProtectionPluginCollection::getEnabledPlugins in User protect 8

Retrieves enabled user protection plugin instances.

Return value

array An array of active user protection plugin instances.

File

src/Plugin/UserProtection/UserProtectionPluginCollection.php, line 51

Class

UserProtectionPluginCollection
A collection of protection rules.

Namespace

Drupal\userprotect\Plugin\UserProtection

Code

public function getEnabledPlugins() {
  $instances = $this
    ->getAll();
  $enabled = [];
  foreach ($this->configurations as $instance_id => $configuration) {
    if ($configuration['status']) {
      $enabled[] = $instances[$instance_id];
    }
  }

  // Sort plugins.
  uasort($enabled, [
    $this,
    'pluginInstancesSort',
  ]);
  return $enabled;
}