You are here

public function UserProtectionPluginCollection::getAll in User protect 8

Retrieves all user protection plugin instances.

Return value

array An array of user protection plugin instances.

1 call to UserProtectionPluginCollection::getAll()
UserProtectionPluginCollection::getEnabledPlugins in src/Plugin/UserProtection/UserProtectionPluginCollection.php
Retrieves enabled user protection plugin instances.

File

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

Class

UserProtectionPluginCollection
A collection of protection rules.

Namespace

Drupal\userprotect\Plugin\UserProtection

Code

public function getAll() {

  // Retrieve all available user protection plugin definitions.
  if (!$this->definitions) {
    $this->definitions = $this->manager
      ->getDefinitions();
  }

  // Ensure that there is an instance of all available plugins.
  foreach ($this->definitions as $plugin_id => $definition) {
    if (!isset($this->pluginInstances[$plugin_id])) {
      $this
        ->initializePlugin($plugin_id);
    }
  }

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