You are here

public function state_flow_entity_handler_field_available_events::render in State Machine 7.3

Render the field.

Parameters

array $values: The values retrieved from the database.

Return value

string The rendered output.

Overrides views_handler_field::render

File

modules/state_flow_entity/includes/views/state_flow_entity_handler_field_available_events.inc, line 32
Prints available state change events for a given entity.

Class

state_flow_entity_handler_field_available_events

Code

public function render($values) {

  // @todo, replace all the hard-coded node assumptions.
  $entities = entity_load('node', FALSE, array(
    'vid' => $this
      ->get_value($values, 'revision_id'),
  ));
  $entity = array_pop($entities);
  $machine = state_flow_entity_load_state_machine($entity, 'node');
  $revision_events = $machine
    ->get_available_events_options(TRUE);
  $state_actions = array();
  foreach ($revision_events as $event_machine_name => $event_label) {
    $state_actions[] = l($event_label, 'node/' . $entity->nid . '/revisions/' . $entity->vid . '/workflow/' . $event_machine_name) . ' ';
  }
  return implode(' | ', $state_actions);
}