You are here

protected function SubscriptionManagerController::getClientsPageSection in Acquia Content Hub 8.2

Returns the "Administer Clients" page sections.

Return value

array Renderable array.

Throws

\Exception

1 call to SubscriptionManagerController::getClientsPageSection()
SubscriptionManagerController::subscriptionSettingsPage in modules/acquia_contenthub_publisher/src/Controller/SubscriptionManagerController.php
Renders "Subscription Settings" page.

File

modules/acquia_contenthub_publisher/src/Controller/SubscriptionManagerController.php, line 130

Class

SubscriptionManagerController
Controller for managing the subscription.

Namespace

Drupal\acquia_contenthub_publisher\Controller

Code

protected function getClientsPageSection() {
  $content['clients_header'] = [
    '#type' => 'html_tag',
    '#tag' => 'h2',
    '#value' => $this
      ->t('Administer Clients'),
  ];
  $content['clients_table'] = [
    '#type' => 'table',
    '#header' => [
      'uuid' => $this
        ->t('UUID'),
      'name' => $this
        ->t('Name'),
      'operations' => $this
        ->t('Operations'),
    ],
    '#empty' => $this
      ->t('No clients found.'),
  ];
  foreach ($this->client
    ->getClients() as $key => $client) {
    $links = [];
    $links['edit'] = [
      'title' => $this
        ->t('edit'),
      'url' => Url::fromRoute('acquia_contenthub_publisher.edit_client', [
        'uuid' => $client['uuid'],
      ]),
    ];
    if ($client['uuid'] !== $this->client
      ->getSettings()
      ->getUuid()) {
      $links['delete'] = [
        'title' => $this
          ->t('delete'),
        'url' => Url::fromRoute('acquia_contenthub_publisher.delete_client', [
          'uuid' => $client['uuid'],
        ]),
      ];
    }
    $content['clients_table'][] = [
      'uuid' => [
        '#markup' => $client['uuid'],
      ],
      'name' => [
        '#markup' => $client['name'],
      ],
      'operations' => [
        '#type' => 'operations',
        '#links' => $links,
      ],
    ];
  }
  return $content;
}