CustomBreadcrumbsListBuilder.php in Custom Breadcrumbs 1.x
File
src/CustomBreadcrumbsListBuilder.php
View source
<?php
namespace Drupal\custom_breadcrumbs;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class CustomBreadcrumbsListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['label'] = $this
->t('Label');
$header['entityType'] = $this
->t('Entity type');
$header['entityBundle'] = $this
->t('Entity bundle');
$header['language'] = $this
->t('Language');
$header['status'] = $this
->t('Status');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity
->label();
$row['entityType'] = $entity
->get('entityType');
$row['entityBundlee'] = $entity
->get('entityBundle');
$row['language'] = $entity
->get('language');
$row['status'] = $entity
->status() ? $this
->t('Enabled') : $this
->t('Disabled');
return $row + parent::buildRow($entity);
}
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
$operations['status'] = [
'title' => $this
->t('Enable/Disable'),
'weight' => 15,
'url' => $this
->ensureDestination($entity
->toUrl('status_form')),
];
return $operations;
}
}