You are here

trait AcquiaContentHubUnregisterHelperTrait in Acquia Content Hub 8.2

Trait with helper functions for unregistration.

@package Drupal\acquia_contenthub

Hierarchy

2 files declare their use of AcquiaContentHubUnregisterHelperTrait
ContentHubDeleteClientConfirmForm.php in src/Form/ContentHubDeleteClientConfirmForm.php
WebhookDeleteConfirmForm.php in modules/acquia_contenthub_publisher/src/Form/Webhook/WebhookDeleteConfirmForm.php

File

src/AcquiaContentHubUnregisterHelperTrait.php, line 12

Namespace

Drupal\acquia_contenthub
View source
trait AcquiaContentHubUnregisterHelperTrait {

  /**
   * Checks if Discovery Interface route exists.
   *
   * @return bool
   *   TRUE if DI route exists, FALSE otherwise.
   */
  public function checkDiscoveryRoute() : bool {
    try {
      $route_provider = \Drupal::service('router.route_provider');
      $route = $route_provider
        ->getRouteByName('acquia_contenthub_curation.discovery');
    } catch (RouteNotFoundException $exception) {
      $route = FALSE;
    }
    return (bool) $route;
  }

  /**
   * Format rows for render array.
   *
   * @return array
   *   Formatted array for table component.
   */
  protected function formatOrphanedFiltersTable(array $filters) : array {
    $rows = [];
    foreach ($filters as $name => $uuid) {
      $rows[] = [
        $name,
        $uuid,
      ];
    }
    return $rows;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AcquiaContentHubUnregisterHelperTrait::checkDiscoveryRoute public function Checks if Discovery Interface route exists.
AcquiaContentHubUnregisterHelperTrait::formatOrphanedFiltersTable protected function Format rows for render array.