diff --git a/src/Plugin/views/relationship/GroupContentToEntityReverse.php b/src/Plugin/views/relationship/GroupContentToEntityReverse.php index 362659e..eaa2d63 100644 --- a/src/Plugin/views/relationship/GroupContentToEntityReverse.php +++ b/src/Plugin/views/relationship/GroupContentToEntityReverse.php @@ -9,7 +9,7 @@ namespace Drupal\group\Plugin\views\relationship; use Drupal\Core\Form\FormStateInterface; use Drupal\group\Entity\GroupContentType; -use Drupal\group\Plugin\GroupContentEnablerHelper; +use Drupal\group\Plugin\GroupContentEnablerManagerInterface; use Drupal\views\Plugin\views\relationship\RelationshipPluginBase; use Drupal\views\Plugin\ViewsHandlerManager; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -29,16 +29,26 @@ class GroupContentToEntityReverse extends RelationshipPluginBase { * @var \Drupal\views\Plugin\ViewsHandlerManager */ protected $joinManager; + + /** + * The group content enabler plugin manager. + * + * @var \Drupal\group\Plugin\GroupContentEnablerManagerInterface + */ + protected $pluginManager; /** * Constructs an GroupContentToEntityReverse object. * * @param \Drupal\views\Plugin\ViewsHandlerManager $join_manager * The views plugin join manager. + * @param \Drupal\group\Plugin\GroupContentEnablerManagerInterface $plugin_manager + * The group content enabler plugin manager. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, ViewsHandlerManager $join_manager) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, ViewsHandlerManager $join_manager, GroupContentEnablerManagerInterface $plugin_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->joinManager = $join_manager; + $this->pluginManager = $plugin_manager; } /** @@ -49,7 +59,8 @@ class GroupContentToEntityReverse extends RelationshipPluginBase { $configuration, $plugin_id, $plugin_definition, - $container->get('plugin.manager.views.join') + $container->get('plugin.manager.views.join'), + $container->get('plugin.manager.group_content_enabler') ); } @@ -80,7 +91,7 @@ class GroupContentToEntityReverse extends RelationshipPluginBase { // Retrieve all of the plugins that can handle this entity type. /** @var \Drupal\group\Plugin\GroupContentEnablerInterface $plugin */ - foreach (GroupContentEnablerHelper::getAllContentEnablers() as $plugin_id => $plugin) { + foreach ($this->pluginManager->getAll() as $plugin_id => $plugin) { if ($plugin->getEntityTypeId() === $this->definition['entity_type']) { $options[$plugin_id] = $plugin->getLabel(); }