TemplateListBuilder.php in Wysiwyg API template plugin 8.2
File
src/TemplateListBuilder.php
View source
<?php
namespace Drupal\wysiwyg_template;
use Drupal\Core\Config\Entity\DraggableListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
class TemplateListBuilder extends DraggableListBuilder {
public function getFormId() : string {
return 'wysiwyg_template_list_form';
}
public function buildHeader() : array {
$header['label'] = $this
->t('Template');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) : array {
$row['label'] = $entity
->label();
return $row + parent::buildRow($entity);
}
public function buildForm(array $form, FormStateInterface $form_state) : array {
$form = parent::buildForm($form, $form_state);
$form[$this->entitiesKey]['#empty'] = $this
->t('There are no WYSIWYG templates yet.');
return $form;
}
}