LayoutListBuilder.php in Bootstrap Layout Builder 2.x
File
src/LayoutListBuilder.php
View source
<?php
namespace Drupal\bootstrap_layout_builder;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class LayoutListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['label'] = $this
->t('Label');
$header['id'] = $this
->t('Machine name');
$header['number_of_columns'] = $this
->t('Number of columns');
return $header + parent::buildHeader();
}
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
$operations['list'] = [
'title' => $this
->t('List options'),
'url' => $entity
->toUrl('options-form'),
];
return $operations;
}
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity
->label();
$row['id'] = $entity
->id();
$row['number_of_columns'] = $entity
->getNumberOfColumns();
return $row + parent::buildRow($entity);
}
}