public function BackupController::listAll in Backup and Migrate 5.0.x
Same name and namespace in other branches
- 8.4 src/Controller/BackupController.php \Drupal\backup_migrate\Controller\BackupController::listAll()
1 string reference to 'BackupController::listAll'
File
- src/
Controller/ BackupController.php, line 27
Class
- BackupController
- @package Drupal\backup_migrate\Controller
Namespace
Drupal\backup_migrate\ControllerCode
public function listAll() {
$storage = \Drupal::entityTypeManager()
->getStorage('backup_migrate_destination');
$out = [];
foreach ($storage
->getQuery()
->execute() as $key) {
$entity = $storage
->load($key);
$destination = $entity
->getObject();
$label = $destination
->confGet('name');
$out[$key] = [
'title' => [
'#markup' => '<h2>' . $this
->t('Most recent backups in %dest', [
'%dest' => $label,
]) . '</h2>',
],
'list' => $this::listDestinationBackups($destination, $key, 5),
];
// Add the more link.
if ($entity
->access('backups') && $entity
->hasLinkTemplate('backups')) {
$out[$key]['link'] = $entity
->toLink($this
->t('View all backups in %dest', [
'%dest' => $label,
]), 'backups')
->toRenderable();
}
}
return $out;
}