You are here

public function GroupTypeController::buildRow in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Controller/GroupTypeController.php \Drupal\group\Entity\Controller\GroupTypeController::buildRow()

Builds a row for a content enabler plugin.

Parameters

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

bool $is_installed: Whether the plugin is installed.

Return value

array A render array to use as a table row.

1 call to GroupTypeController::buildRow()
GroupTypeController::content in src/Entity/Controller/GroupTypeController.php
Builds an admin interface to manage the group type's group content plugins.

File

src/Entity/Controller/GroupTypeController.php, line 154

Class

GroupTypeController
Provides the user permissions administration form for a specific group type.

Namespace

Drupal\group\Entity\Controller

Code

public function buildRow(GroupContentEnablerInterface $plugin, $is_installed) {
  $status = $is_installed ? $this
    ->t('Installed') : $this
    ->t('Available');
  $install_type = $this
    ->t('Manual');
  if ($plugin
    ->isEnforced()) {
    $install_type = $this
      ->t('Enforced');
  }
  elseif ($plugin
    ->isCodeOnly()) {
    $install_type = $this
      ->t('Code-only');
  }
  $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,
    ],
    'install_type' => [
      '#markup' => $install_type,
    ],
    'operations' => $this
      ->buildOperations($plugin, $is_installed),
  ];

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