ContributorRoleListBuilder.php in Bibliography & Citation 8
File
modules/bibcite_entity/src/ContributorRoleListBuilder.php
View source
<?php
namespace Drupal\bibcite_entity;
use Drupal\Core\Config\Entity\DraggableListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
class ContributorRoleListBuilder extends DraggableListBuilder {
public function getFormId() {
return 'bibcite_contributor_role_overview';
}
public function buildHeader() {
$header['label'] = $this
->t('Contributor role');
$header['id'] = $this
->t('Machine name');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity
->label();
$row['id'] = [
'#markup' => $entity
->id(),
];
return $row + parent::buildRow($entity);
}
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$form['role_list_description'] = [
'#type' => 'label',
'#title' => $this
->t('First value in the list is used as default contributor role.'),
];
return $form;
}
}