You are here

public function CookieCategoryListBuilder::buildRow in EU Cookie Compliance (GDPR Compliance) 2.0.x

Same name and namespace in other branches
  1. 8 src/CookieCategoryListBuilder.php \Drupal\eu_cookie_compliance\CookieCategoryListBuilder::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 DraggableListBuilder::buildRow

See also

\Drupal\Core\Entity\EntityListBuilder::render()

File

src/CookieCategoryListBuilder.php, line 44

Class

CookieCategoryListBuilder
Provides a listing of Cookie category entities.

Namespace

Drupal\eu_cookie_compliance

Code

public function buildRow(EntityInterface $entity) {
  $mapping = $this->storage
    ->getCheckboxDefaultStateOptionsList();
  $row['sorter'] = [
    '#markup' => '',
  ];
  $row['label'] = $entity
    ->label();
  $row['id'] = [
    '#markup' => $entity
      ->id(),
  ];
  $row['description'] = [
    '#markup' => $entity
      ->get('description'),
  ];
  $row['checkbox_default_state'] = [
    '#markup' => isset($mapping[$entity
      ->get('checkbox_default_state')]) ? $mapping[$entity
      ->get('checkbox_default_state')] : $mapping['unchecked'],
  ];
  return $row + parent::buildRow($entity);
}