You are here

public function EventGroupTypeController::buildEventRow in Event 8

Builds a row for a content enabler plugin.

Parameters

\Drupal\group\Plugin\GroupContentEnablerInterface $plugin: The content enabler plugin to build operation links for.

Return value

array A render array to use as a table row.

1 call to EventGroupTypeController::buildEventRow()
EventGroupTypeController::content in modules/event_group/src/Controller/EventGroupTypeController.php
Builds an admin interface to manage the group type's group content plugins.

File

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

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 buildEventRow(GroupContentEnablerInterface $plugin) {

  // Events plugin is always installed.
  $status = $this
    ->t('Installed*');
  $row = [
    'info' => [
      '#type' => 'inline_template',
      '#template' => '<div class="description"><span class="label">{{ label }}</span>{% if description %}<br/>{{ description }}{% endif %}</div>',
      '#context' => [
        'label' => $plugin
          ->getLabel(),
      ],
    ],
    'provider' => [
      '#markup' => $this->moduleHandler
        ->getName($plugin
        ->getProvider()),
    ],
    'entity_type_id' => [
      '#markup' => $this->entityTypeManager
        ->getDefinition($plugin
        ->getEntityTypeId())
        ->getLabel(),
    ],
    'status' => [
      '#markup' => $status,
    ],
    'operations' => $this
      ->buildOperations($plugin),
  ];

  // Show the content enabler description if toggled on.
  if (!system_admin_compact_mode()) {
    $row['info']['#context']['description'] = $plugin
      ->getDescription();
  }
  return $row;
}