You are here

public function OpignoModuleListBuilder::buildRow in Opigno module 8

Same name and namespace in other branches
  1. 3.x src/OpignoModuleListBuilder.php \Drupal\opigno_module\OpignoModuleListBuilder::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/OpignoModuleListBuilder.php, line 81

Class

OpignoModuleListBuilder
Defines a class to build a listing of Module entities.

Namespace

Drupal\opigno_module

Code

public function buildRow(EntityInterface $entity) {

  /* @var $entity \Drupal\opigno_module\Entity\OpignoModule */
  $row['id'] = $entity
    ->id();
  $row['name'] = Link::createFromRoute($entity
    ->label(), 'opigno_module.edit', [
    'opigno_module' => $entity
      ->id(),
  ]);

  // Change default edit link.
  $ops = parent::buildRow($entity);
  $destination = $_SERVER['REQUEST_URI'];
  $ops['operations']['data']['#links']['edit']['url'] = new Url('opigno_module.edit', [
    'opigno_module' => $entity
      ->id(),
  ], [
    'query' => [
      'destination' => $destination,
    ],
  ]);
  return $row + $ops;
}