You are here

protected function GroupContentEnablerManager::getVanillaInstalled in Group 8

Retrieves a vanilla instance of every installed plugin.

Return value

\Drupal\group\Plugin\GroupContentEnablerCollection A plugin collection with a vanilla instance of every installed plugin.

1 call to GroupContentEnablerManager::getVanillaInstalled()
GroupContentEnablerManager::getInstalled in src/Plugin/GroupContentEnablerManager.php
Returns a plugin collection of all installed content enablers.

File

src/Plugin/GroupContentEnablerManager.php, line 236

Class

GroupContentEnablerManager
Manages GroupContentEnabler plugin implementations.

Namespace

Drupal\group\Plugin

Code

protected function getVanillaInstalled() {

  // Retrieve a vanilla instance of all known content enabler plugins.
  $plugins = clone $this
    ->getAll();

  // Retrieve all installed content enabler plugin IDs.
  $installed = $this
    ->getInstalledIds();

  // Remove uninstalled plugins from the collection.

  /** @var \Drupal\group\Plugin\GroupContentEnablerCollection $plugins */
  foreach ($plugins as $plugin_id => $plugin) {
    if (!in_array($plugin_id, $installed)) {
      $plugins
        ->removeInstanceId($plugin_id);
    }
  }
  return $plugins;
}