You are here

protected function EntityUpdateManager::getEnabledPlugins in Entity Usage 8.3

Same name and namespace in other branches
  1. 8.2 src/EntityUpdateManager.php \Drupal\entity_usage\EntityUpdateManager::getEnabledPlugins()

Get the enabled tracking plugins, all plugins are enabled by default.

Return value

\Drupal\entity_usage\EntityUsageTrackInterface[] The enabled plugin instances.

2 calls to EntityUpdateManager::getEnabledPlugins()
EntityUpdateManager::trackUpdateOnCreation in src/EntityUpdateManager.php
Track updates on creation of potential source entities.
EntityUpdateManager::trackUpdateOnEdition in src/EntityUpdateManager.php
Track updates on edit / update of potential source entities.

File

src/EntityUpdateManager.php, line 312

Class

EntityUpdateManager
Class EntityUpdateManager.

Namespace

Drupal\entity_usage

Code

protected function getEnabledPlugins() {
  $all_plugin_ids = array_keys($this->trackManager
    ->getDefinitions());
  $enabled_plugins = $this->config
    ->get('track_enabled_plugins');
  $enabled_plugin_ids = is_array($enabled_plugins) ? $enabled_plugins : $all_plugin_ids;
  $plugins = [];
  foreach (array_intersect($all_plugin_ids, $enabled_plugin_ids) as $plugin_id) {

    /** @var EntityUsageTrackInterface $instance */
    $plugins[$plugin_id] = $this->trackManager
      ->createInstance($plugin_id);
  }
  return $plugins;
}