DestinationListBuilder.php in Backup and Migrate 8.4
File
src/Controller/DestinationListBuilder.php
View source
<?php
namespace Drupal\backup_migrate\Controller;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class DestinationListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['label'] = $this
->t('Backup Destination');
$header['id'] = $this
->t('Machine name');
$header['type'] = $this
->t('Type');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity
->label();
$row['id'] = $entity
->id();
$row['type'] = $entity
->get('type');
if ($plugin = $entity
->getPlugin()) {
$info = $plugin
->getPluginDefinition();
$row['type'] = $info['title'];
}
return $row + parent::buildRow($entity);
}
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
if ($entity
->access('backups') && $entity
->hasLinkTemplate('backups')) {
$operations['backups'] = [
'title' => $this
->t('List Backups'),
'weight' => 100,
'url' => $entity
->toUrl('backups'),
];
}
return $operations;
}
}