public function ReplicationListBuilder::render in Deploy - Content Staging 8
Builds the entity listing as renderable array for table.html.twig.
@todo Add a link to add a new item to the #empty text.
Overrides EntityListBuilder::render
File
- src/
ReplicationListBuilder.php, line 74
Class
- ReplicationListBuilder
- Defines a class to build a listing of Replication entities.
Namespace
Drupal\deployCode
public function render() {
// Determine when cron last ran.
$cron_last = \Drupal::state()
->get('system.cron_last');
if (!is_numeric($cron_last)) {
$cron_last = \Drupal::state()
->get('install_time', 0);
}
$build = [];
$build['#markup'] = '';
if (\Drupal::state()
->get('workspace.last_replication_failed', FALSE)) {
$message = $this
->generateMessageRenderArray('warning', $this
->t('Creation of new deployments has been blocked due to a failure. Contact your administrator to get the issue resolved and deployments unblocked.'));
$user_has_access = \Drupal::currentUser()
->hasPermission('administer site configuration');
if ($user_has_access) {
$message = $this
->generateMessageRenderArray('warning', $this
->t('Creation of new deployments has been blocked due to a failure. After resolving the issue, go to the <a href="@url">replication settings</a> page to unblock deployments.', [
'@url' => '/admin/config/replication/settings',
]));
}
elseif ($support_email = Settings::get('support_email_address', NULL)) {
$message = $this
->generateMessageRenderArray('warning', $this
->t('Creating new deployments is not allowed at the moment. Please contact the <a href="mailto:@url">support team</a> to unblock creating new content deployments.', [
'@url' => $support_email,
]));
}
$build['#markup'] .= \Drupal::service('renderer')
->render($message);
}
$build['#markup'] .= $this
->t('Last cron ran @time ago', [
'@time' => \Drupal::service('date.formatter')
->formatTimeDiffSince($cron_last),
]);
$build += parent::render();
return $build;
}