You are here

protected function EntityLegalDocumentUIController::overviewTableRow in Entity Legal 7

Same name and namespace in other branches
  1. 7.2 entity_legal.entity_admin.inc \EntityLegalDocumentUIController::overviewTableRow()

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

File

./entity_legal.entity_admin.inc, line 37
Admin ui controllers for entity_legal entities.

Class

EntityLegalDocumentUIController
Legal Document entity ui controller.

Code

protected function overviewTableRow($conditions, $id, $entity, $additional_cols = array()) {
  $entity_uri = entity_uri($this->entityType, $entity);
  $row[] = array(
    'data' => array(
      '#theme' => 'entity_ui_overview_item',
      '#label' => check_plain(entity_label($this->entityType, $entity)),
      '#name' => !empty($this->entityInfo['exportable']) ? entity_id($this->entityType, $entity) : FALSE,
      '#url' => $entity_uri ? $entity_uri : FALSE,
      '#entity_type' => $this->entityType,
    ),
  );

  // Add a row for the exportable status.
  $row[] = array(
    'data' => array(
      '#theme' => 'entity_status',
      '#status' => $entity->{$this->statusKey},
    ),
  );

  // Add operations depending on the status.
  if (entity_has_status($this->entityType, $entity, ENTITY_FIXED)) {
    $row[] = array(
      'data' => l(t('clone'), $this->path . '/manage/' . $id . '/clone'),
      'colspan' => $this
        ->operationCount(),
    );
  }
  else {
    $row[] = l(t('edit'), $this->path . '/manage/' . $id);
    $row[] = l(t('clone'), $this->path . '/manage/' . $id . '/clone');
    if (empty($this->entityInfo['exportable']) || !entity_has_status($this->entityType, $entity, ENTITY_IN_CODE)) {
      $row[] = l(t('delete'), $this->path . '/manage/' . $id . '/delete', array(
        'query' => drupal_get_destination(),
      ));
    }
    elseif (entity_has_status($this->entityType, $entity, ENTITY_OVERRIDDEN)) {
      $row[] = l(t('revert'), $this->path . '/manage/' . $id . '/revert', array(
        'query' => drupal_get_destination(),
      ));
    }
    else {
      $row[] = '';
    }
  }
  $row[] = l(t('export'), $this->path . '/manage/' . $id . '/export');
  return $row;
}