public function ReplicationFailInfoController::viewFailInfo 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 'ReplicationFailInfoController::viewFailInfo'
File
- src/
Controller/ ReplicationFailInfoController.php, line 20
Class
Namespace
Drupal\deploy\ControllerCode
public function viewFailInfo($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,
];
if (!empty($entity->replicated->value)) {
$arguments['%timestamp'] = DrupalDateTime::createFromTimestamp($entity->replicated->value)
->format('Y/m/d H:i:s e');
}
else {
$arguments['%timestamp'] = $this
->t('unknown date');
}
$build['#markup'] = $this
->t('Deployment failed when replicating content from %source to %target on %timestamp.', $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;
}