You are here

protected function FlexiformUIController::overviewTableRow in Flexiform 7

Overrides overviewTableRow();

Overrides EntityDefaultUIController::overviewTableRow

1 call to FlexiformUIController::overviewTableRow()
FlexiformUIController::overviewTable in ./flexiform.admin.inc
Overrides overviewTable();

File

./flexiform.admin.inc, line 107
Model type editing UI.

Class

FlexiformUIController
UI controller.

Code

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

  // Take the first column as usual.
  $row[] = array(
    'data' => array(
      '#theme' => 'flexiform_ui_overview_item',
      '#label' => entity_label($this->entityType, $entity),
      '#tags' => drupal_implode_tags($entity->tags),
      '#name' => !empty($this->entityInfo['exportable']) ? entity_id($this->entityType, $entity) : FALSE,
      '#url' => array(
        'path' => $this->path . '/manage/' . $id,
        'options' => array(),
      ),
      '#entity_type' => $this->entityType,
    ),
  );

  // Add the base entity.
  $base_info = entity_get_info($entity->base_entity);
  $row[] = $base_info['label'];
  $row[] = $base_info['bundles'][$entity->base_entity_bundle]['label'];

  // Add in any passed additional cols.
  foreach ($additional_cols as $col) {
    $row[] = $col;
  }
  $row[] = array(
    'data' => array(
      '#theme' => 'entity_status',
      '#status' => $entity->{$this->statusKey},
    ),
  );
  $i18n = !empty($this->entityInfo['i18n controller class']);

  // 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);
    $base_path = $this->path . '/manage/' . $id . '/';
    $row[] = drupal_valid_path($base_path . 'form-fields') ? l(t('manage form fields'), $base_path . 'form-fields') : '';
    $row[] = drupal_valid_path($base_path . 'form-entities') ? l(t('manage form entities'), $base_path . 'form-entities') : '';
    if ($i18n) {
      $row[] = l(t('translate'), $this->path . '/manage/' . $id . '/translate');
    }
    $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;
}