You are here

protected function UnitsMeasureUIController::overviewTableRow in Units of Measurement 7

Same name and namespace in other branches
  1. 7.2 includes/UnitsMeasureUIController.class.inc \UnitsMeasureUIController::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

includes/UnitsMeasureUIController.class.inc, line 19
Definition of UnitsMeasureUIController class.

Class

UnitsMeasureUIController
Admin UI controller class for entity type 'units_measure'.

Code

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

  // Adding extra cell for managing units of this measure.
  $units_entity_info = entity_get_info('units_unit');
  $additional_cols[] = l('manage units', str_replace('%units_measure_machine_name', $entity->measure, $units_entity_info['admin ui']['path']));
  $row = parent::overviewTableRow($conditions, $id, $entity, $additional_cols);

  // We have to strip out "Manage Display" link, as currently units cannot be
  // viewed.
  foreach ($row as $i => $cell) {
    if (is_array($cell)) {
      $cell = $cell['data'];
    }
    if (is_scalar($cell) && strpos($cell, $this->path . '/manage/' . $id . '/display') !== FALSE) {
      $row[$i] = '';
      break;
    }
  }
  return $row;
}