public function TaskListBuilder::buildRow in General Data Protection Regulation 8
Same name and namespace in other branches
- 8.2 modules/gdpr_tasks/src/TaskListBuilder.php \Drupal\gdpr_tasks\TaskListBuilder::buildRow()
- 3.0.x modules/gdpr_tasks/src/TaskListBuilder.php \Drupal\gdpr_tasks\TaskListBuilder::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()
1 call to TaskListBuilder::buildRow()
- TaskListBuilder::render in modules/
gdpr_tasks/ src/ TaskListBuilder.php - Builds the entity listing as renderable array for table.html.twig.
File
- modules/
gdpr_tasks/ src/ TaskListBuilder.php, line 69
Class
- TaskListBuilder
- Defines a class to build a listing of Task entities.
Namespace
Drupal\gdpr_tasksCode
public function buildRow(EntityInterface $entity) {
/* @var $entity \Drupal\gdpr_tasks\Entity\Task */
$row['id'] = $entity
->id();
$row['name'] = Link::createFromRoute($entity
->label(), 'entity.gdpr_task.canonical', [
'gdpr_task' => $entity
->id(),
]);
$row['user'] = $entity
->getOwner()
->toLink()
->toString();
$row['type'] = $this->bundleStorage
->load($entity
->bundle())
->label();
$row['created'] = DateTimePlus::createFromTimestamp($entity
->getCreatedTime())
->format('j/m/Y - H:m');
$date_formatter = \Drupal::service('date.formatter');
$row['created'] .= ' - ' . $date_formatter
->formatDiff($entity
->getCreatedTime(), \Drupal::time()
->getRequestTime(), [
'granularity' => 1,
]) . ' ago';
$row['requested_by'] = $entity->requested_by->entity
->toLink()
->toString();
return $row + parent::buildRow($entity);
}