Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 22 |
| ContactFormListBuilder | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 22 |
| buildHeader | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 5 |
|||
| buildRow | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 17 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\contact\ContactFormListBuilder. | |
| */ | |
| namespace Drupal\contact; | |
| use Drupal\Core\Config\Entity\ConfigEntityListBuilder; | |
| use Drupal\Core\Entity\EntityInterface; | |
| /** | |
| * Defines a class to build a listing of contact form entities. | |
| * | |
| * @see \Drupal\contact\Entity\ContactForm | |
| */ | |
| class ContactFormListBuilder extends ConfigEntityListBuilder { | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function buildHeader() { | |
| $header['form'] = t('Form'); | |
| $header['recipients'] = t('Recipients'); | |
| $header['selected'] = t('Selected'); | |
| return $header + parent::buildHeader(); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function buildRow(EntityInterface $entity) { | |
| // Special case the personal form. | |
| if ($entity->id() == 'personal') { | |
| $row['form'] = $entity->label(); | |
| $row['recipients'] = t('Selected user'); | |
| $row['selected'] = t('No'); | |
| } | |
| else { | |
| $row['form'] = $entity->link(NULL, 'canonical'); | |
| $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); | |
| } | |
| } |