You are here

public function ItemListBuilder::buildRow in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/ItemListBuilder.php \Drupal\business_rules\ItemListBuilder::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/ItemListBuilder.php, line 33

Class

ItemListBuilder
Provides a listing of Business rules Items entities.

Namespace

Drupal\business_rules

Code

public function buildRow(EntityInterface $entity) {
  $row['label'] = [
    'data' => [
      '#markup' => $entity
        ->label(),
    ],
  ];
  $row['id'] = [
    'data' => [
      '#markup' => $entity
        ->id(),
    ],
  ];
  $row['type'] = [
    'data' => [
      '#markup' => $entity
        ->getTypeLabel(),
    ],
  ];
  $row['description'] = [
    'data' => [
      '#markup' => $entity
        ->getDescription(),
    ],
  ];
  $row['tags'] = implode(', ', $entity
    ->getTags());
  $search_string = $entity
    ->label() . ' ' . $entity
    ->id() . ' ' . $entity
    ->getTypeLabel() . ' ' . $entity
    ->getTypeLabel() . ' ' . $entity
    ->getDescription() . ' ' . implode(' ', $entity
    ->getTags());
  $row['filter'] = [
    'data' => [
      [
        '#markup' => '<span class="table-filter-text-source">' . $search_string . '</span>',
      ],
    ],
    'style' => [
      'display: none',
    ],
  ];
  return $row + parent::buildRow($entity);
}