You are here

public function RegistrationListBuilder::buildRow in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/Lists/RegistrationListBuilder.php \Drupal\rng\Lists\RegistrationListBuilder::buildRow()
  2. 3.x src/Lists/RegistrationListBuilder.php \Drupal\rng\Lists\RegistrationListBuilder::buildRow()

Parameters

\Drupal\rng\RegistrationInterface $entity: A registration entity.

Overrides EntityListBuilder::buildRow

File

src/Lists/RegistrationListBuilder.php, line 119

Class

RegistrationListBuilder
Builds a list of registrations.

Namespace

Drupal\rng\Lists

Code

public function buildRow(EntityInterface $entity) {
  $row['counter'] = ++$this->row_counter;
  $bundle = entity_load($this->entityType
    ->getBundleEntityType(), $entity
    ->bundle());
  $row['type'] = $bundle ? $bundle
    ->label() : '';
  $row['groups']['data'] = array(
    '#theme' => 'item_list',
    '#items' => [],
    '#attributes' => [
      'class' => [
        'inline',
      ],
    ],
  );
  foreach ($entity
    ->getGroups() as $group) {
    $text = '@group_label';
    $t_args = [
      '@group_id' => $group
        ->id(),
      '@group_label' => $group
        ->label(),
    ];
    $options['context'] = $group
      ->isUserGenerated() ? 'system' : 'user';
    $row['groups']['data']['#items'][] = $this
      ->t($group
      ->isUserGenerated() ? $text : "<em>{$text}</em>", $t_args, $options);
  }
  $row['created'] = format_date($entity->created->value);
  return $row + parent::buildRow($entity);
}