public function AgreementListBuilder::buildRow in Agreement 3.0.x
Same name and namespace in other branches
- 8.2 src/Entity/AgreementListBuilder.php \Drupal\agreement\Entity\AgreementListBuilder::buildRow()
Builds a row for an entity in the entity listing.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.
Return value
array A render array structure of fields for this entity.
Overrides EntityListBuilder::buildRow
See also
\Drupal\Core\Entity\EntityListBuilder::render()
File
- src/
Entity/ AgreementListBuilder.php, line 29
Class
- AgreementListBuilder
- Provides simple operations list.
Namespace
Drupal\agreement\EntityCode
public function buildRow(EntityInterface $entity) {
$settings = $entity
->getSettings();
$roles = array_reduce($settings['roles'], function (&$result, $item) {
$result[] = $item;
return $result;
}, []);
$visibility_options = [
$this
->t('Show on every page except the listed pages'),
$this
->t('Show on only the listed pages'),
];
return [
'label' => $entity
->label(),
'path' => [
'data' => [
'#type' => 'link',
'#url' => Url::fromUserInput($entity
->get('path')),
'#title' => $entity
->get('path'),
],
],
'roles' => [
'data' => [
'#theme' => 'item_list',
'#items' => $roles,
],
],
'visibility' => $visibility_options[$settings['visibility']['settings']],
] + parent::buildRow($entity);
}