BUEditorEditorListBuilder.php in BUEditor 8
File
src/BUEditorEditorListBuilder.php
View source
<?php
namespace Drupal\bueditor;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class BUEditorEditorListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['label'] = $this
->t('Name');
$header['description'] = $this
->t('Description');
$header['toolbar'] = $this
->t('Toolbar');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $bueditor_editor) {
$row['label'] = $bueditor_editor
->label();
$row['description'] = $bueditor_editor
->get('description');
$row['toolbar'] = implode(', ', $bueditor_editor
->getToolbar());
return $row + parent::buildRow($bueditor_editor);
}
public function getDefaultOperations(EntityInterface $bueditor_editor) {
$operations = parent::getDefaultOperations($bueditor_editor);
$operations['duplicate'] = [
'title' => $this
->t('Duplicate'),
'weight' => 15,
'url' => $bueditor_editor
->toUrl('duplicate-form'),
];
return $operations;
}
}