You are here

function drush_acquia_contenthub_remote in Acquia Content Hub 8

Loads and prints a remote entity in CDF Format.

Parameters

string $uuid: Entity's UUID.

Return value

mixed|false Returns an array containing the CDF of a remote entity

File

./acquia_contenthub.drush.inc, line 284
ContentHub Drush Commands.

Code

function drush_acquia_contenthub_remote($uuid) {
  if (Uuid::isValid($uuid)) {

    /** @var \Drupal\acquia_contenthub\Client\ClientManager $client_manager */
    $client_manager = \Drupal::service('acquia_contenthub.client_manager');
    if ($entity = $client_manager
      ->createRequest('readEntity', [
      $uuid,
    ])) {
      return (array) $entity;
    }
    else {
      drush_print(dt("The Content Hub does not have an entity with UUID = @uuid.", [
        '@uuid' => $uuid,
      ]));
    }
  }
  else {
    return drush_set_error(dt("Argument provided is not a UUID."));
  }
  return FALSE;
}