You are here

public function SearchApiPageListBuilder::buildRow in Search API Pages 8

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/SearchApiPageListBuilder.php, line 27

Class

SearchApiPageListBuilder
Provides a listing of Search page entities.

Namespace

Drupal\search_api_page

Code

public function buildRow(EntityInterface $entity) {

  /* @var $entity \Drupal\search_api_page\SearchApiPageInterface */
  $row['label'] = $entity
    ->label();
  $row['path'] = '';
  $path = $entity
    ->getPath();
  if ($path !== '') {
    $route = sprintf('search_api_page.%s.%s', \Drupal::languageManager()
      ->getDefaultLanguage()
      ->getId(), $entity
      ->id());
    $row['path'] = Link::createFromRoute($path, $route);
  }
  return $row + parent::buildRow($entity);
}