protected function SubscriptionManagerController::getWebhookPageSection in Acquia Content Hub 8.2
Returns the "Administer Webhooks" page sections.
Return value
array Renderable array.
Throws
\Exception
1 call to SubscriptionManagerController::getWebhookPageSection()
- 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 66
Class
- SubscriptionManagerController
- Controller for managing the subscription.
Namespace
Drupal\acquia_contenthub_publisher\ControllerCode
protected function getWebhookPageSection() {
$content['webhooks_header'] = [
'#type' => 'html_tag',
'#tag' => 'h2',
'#value' => $this
->t('Administer Webhooks'),
];
$content['webhooks_table'] = [
'#type' => 'table',
'#header' => [
'uuid' => $this
->t('UUID'),
'url' => $this
->t('URL'),
'operations' => $this
->t('Operations'),
],
'#empty' => $this
->t('No webhooks found.'),
];
foreach ($this->client
->getWebHooks() as $key => $webhook) {
$links = [];
$webhook_uuid = $webhook
->getUuid();
if (!$webhook
->isEnabled()) {
$links['enable'] = [
'title' => $this
->t('re-enable'),
'url' => Url::fromRoute('acquia_contenthub_publisher.enable_webhook', [
'uuid' => $webhook_uuid,
]),
];
}
else {
$links['edit'] = [
'title' => $this
->t('edit'),
'url' => Url::fromRoute('acquia_contenthub_publisher.edit_webhook', [
'uuid' => $webhook_uuid,
]),
];
$links['delete'] = [
'title' => $this
->t('delete'),
'url' => Url::fromRoute('acquia_contenthub_publisher.delete_webhook', [
'uuid' => $webhook_uuid,
]),
];
}
$content['webhooks_table'][] = [
'uuid' => [
'#markup' => $webhook_uuid,
],
'url' => [
'#markup' => $webhook
->getUrl(),
],
'operations' => [
'#type' => 'operations',
'#links' => $links,
],
];
}
return $content;
}