You are here

protected function GDPRTaskUIController::overviewTableRow in General Data Protection Regulation 7

Generates the row for the passed entity and may be overridden in order to customize the rows.

Parameters

$additional_cols: Additional columns to be added after the entity label column.

Overrides EntityDefaultUIController::overviewTableRow

1 call to GDPRTaskUIController::overviewTableRow()
GDPRTaskUIController::overviewTable in modules/gdpr_tasks/src/Entity/GDPRTaskUIController.php
Generates the render array for a overview tables for different statuses.

File

modules/gdpr_tasks/src/Entity/GDPRTaskUIController.php, line 100

Class

GDPRTaskUIController
The Task type entity controller class.

Code

protected function overviewTableRow($conditions, $id, $entity, $additional_cols = array()) {

  /* @var GDPRTask $entity */
  $time_diff = REQUEST_TIME - $entity->created;
  $created_ago = t('%time ago', array(
    '%time' => format_interval($time_diff, 1),
  ));
  $additional_cols = array(
    $entity
      ->bundleLabel(),
    $entity->status,
    theme('username', array(
      'account' => user_load($entity->user_id),
    )),
    format_date($entity->created, 'short') . ' - ' . $created_ago,
  );
  $row = parent::overviewTableRow($conditions, $id, $entity, $additional_cols);

  // @todo Fix hardcoded links.
  $row[0] = l($entity
    ->label(), $this->path . '/' . $id . '/view', array(
    'query' => drupal_get_destination(),
  ));
  $row[5] = l(t('edit'), $this->path . '/' . $id . '/edit', array(
    'query' => drupal_get_destination(),
  ));
  $row[6] = l(t('delete'), $this->path . '/' . $id . '/delete', array(
    'query' => drupal_get_destination(),
  ));
  return $row;
}