You are here

public function EventGroupTypeController::content in Event 8

Builds an admin interface to manage the group type's group content plugins.

Parameters

\Drupal\group\Entity\GroupTypeInterface $group_type: The group type to build an interface for.

Return value

array The render array for the page.

Overrides GroupTypeController::content

File

modules/event_group/src/Controller/EventGroupTypeController.php, line 24

Class

EventGroupTypeController
Overrides the Group Content page to show that events are always installed. Yes, this code is all so that an Asterisk (*) shows up for event group types.

Namespace

Drupal\event_group\Controller

Code

public function content(GroupTypeInterface $group_type) {
  $page = parent::content($group_type);
  $plugin_id = 'event_group';
  $installed = $this->pluginManager
    ->getInstalledIds($group_type);
  $plugin = $this->pluginManager
    ->getDefinition($plugin_id);

  // If the plugin is installed on the group type, use that one instead of
  // an 'empty' version so that we may use methods on it which expect to
  // have a group type configured.
  if (in_array($plugin_id, $installed)) {
    $plugin = $this->groupType
      ->getContentPlugin($plugin['id']);
  }
  $page['content'][$plugin_id] = $this
    ->buildEventRow($plugin);
  return $page;
}