ContactFormListBuilder.php in Drupal 10
File
core/modules/contact/src/ContactFormListBuilder.php
View source
<?php
namespace Drupal\contact;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class ContactFormListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['form'] = t('Form');
$header['recipients'] = t('Recipients');
$header['selected'] = t('Selected');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
if ($entity
->id() == 'personal') {
$row['form'] = $entity
->label();
$row['recipients'] = t('Selected user');
$row['selected'] = t('No');
}
else {
$row['form'] = $entity
->toLink(NULL, 'canonical')
->toString();
$row['recipients']['data'] = [
'#theme' => 'item_list',
'#items' => $entity
->getRecipients(),
'#context' => [
'list_style' => 'comma-list',
],
];
$default_form = \Drupal::config('contact.settings')
->get('default_form');
$row['selected'] = $default_form == $entity
->id() ? t('Yes') : t('No');
}
return $row + parent::buildRow($entity);
}
}