You are here

public function PathFileEntityListBuilder::buildRow in Path File 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/PathFileEntityListBuilder.php, line 76

Class

PathFileEntityListBuilder
Defines a class to build a listing of Path file entity entities.

Namespace

Drupal\path_file

Code

public function buildRow(EntityInterface $entity) {

  /* @var $entity \Drupal\path_file\Entity\PathFileEntity */

  // display name as a link to the edit form
  $row['name'] = $entity
    ->toLink(NULL, 'edit-form');

  // Display path, links to the file itself.
  $row['url'] = $entity
    ->toLink($entity
    ->toUrl()
    ->toString());

  // Show published status.
  $row['status'] = $entity
    ->isPublished() ? $this
    ->t('published') : $this
    ->t('not published');

  // Last changed date.
  $row['changed'] = $this->dateFormatter
    ->format($entity
    ->getChangedTime(), 'short');
  return $row + parent::buildRow($entity);
}