You are here

public function EventGroupContentEnablerManager::installEventPlugin in Event 8

Installs the Event Group plugins on Event groups. *

Throws

\Drupal\Core\Entity\EntityStorageException

File

modules/event_group/src/Plugin/EventGroupContentEnablerManager.php, line 24

Class

EventGroupContentEnablerManager
Manages GroupContentEnabler plugin implementations.

Namespace

Drupal\event_group\Plugin

Code

public function installEventPlugin() {

  // Only work on the event group.
  $group_type = $this
    ->getGroupTypeStorage()
    ->load('events');

  // If we're looking at a specific group, return if its not event.
  if (!isset($group_type)) {
    return;
  }
  $plugin_id = 'event_group';
  $installed = $this
    ->getInstalledIds($group_type);
  if (!in_array($plugin_id, $installed)) {
    $this
      ->getGroupContentTypeStorage()
      ->createFromPlugin($group_type, $plugin_id)
      ->save();
  }
}