bibcite-8.x-1.x-dev/modules/bibcite_entity/src/ContributorCategoryListBuilder.php
modules/bibcite_entity/src/ContributorCategoryListBuilder.php
<?php
namespace Drupal\bibcite_entity;
use Drupal\Core\Config\Entity\DraggableListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a listing of Contributor category entities.
*/
class ContributorCategoryListBuilder extends DraggableListBuilder {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'bibcite_contributor_category_overview';
}
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['label'] = $this->t('Contributor category');
$header['id'] = $this->t('Machine name');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity->label();
$row['id'] = [
'#markup' => $entity->id(),
];
return $row + parent::buildRow($entity);
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$form['category_list_description'] = [
'#type' => 'label',
'#title' => $this->t('First value in the list is used as default contributor category.'),
];
return $form;
}
}
