You are here

public function ReplicationRequeueInfoController::viewRequeueInfo in Deploy - Content Staging 8

Title callback.

Parameters

int $replication_id:

Return value

string Array of page elements to render. Array of page elements to render.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 string reference to 'ReplicationRequeueInfoController::viewRequeueInfo'
deploy.routing.yml in ./deploy.routing.yml
deploy.routing.yml

File

src/Controller/ReplicationRequeueInfoController.php, line 23

Class

ReplicationRequeueInfoController

Namespace

Drupal\deploy\Controller

Code

public function viewRequeueInfo($replication_id) {

  /** @var \Drupal\workspace\Entity\Replication $entity */
  $entity = $this
    ->entityTypeManager()
    ->getStorage('replication')
    ->load($replication_id);
  $source = $target = $this
    ->t('*' . 'Unknown' . '*');
  if (!empty($entity->source->entity)) {
    $source = $entity->source->entity
      ->label();
  }
  if (!empty($entity->target->entity)) {
    $target = $entity->target->entity
      ->label();
  }
  $arguments = [
    '%source' => $source,
    '%target' => $target,
  ];
  $build['#markup'] = $this
    ->t('Deployment from %source to %target has been requeued.', $arguments);
  $build['#markup'] .= "</br></br>";
  if (!empty($entity
    ->getReplicationFailInfo())) {
    $build['#markup'] .= $this
      ->t('<strong>Reason: </strong>') . $entity
      ->getReplicationFailInfo();
  }
  else {
    $build['#markup'] .= $this
      ->t('Reason: Unknown.');
  }
  $build['#markup'] .= "</br></br>";
  $build['#markup'] .= $this
    ->t('Please check the logs for more info.');
  return $build;
}