public function state_flow_entity_handler_field_state_flow_states_history_list::render in State Machine 7.3
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- modules/
state_flow_entity/ includes/ views/ state_flow_entity_handler_field_state_flow_states_history_list.inc, line 80 - A field handler to take a record form {state_flow_states} and load all of the relevant history entities.
Class
- state_flow_entity_handler_field_state_flow_states_history_list
- @file A field handler to take a record form {state_flow_states} and load all of the relevant history entities.
Code
public function render($values) {
// @todo, There may be a better place to add this CSS.
drupal_add_css(drupal_get_path('module', 'state_flow_entity') . '/css/state_flow_entity.css');
// Get the entity type and revision id for the parent entity.
$revision_id = $this
->get_value($values, 'revision_id');
$entity_type = $this
->get_value($values, 'entity_type');
// An array of state_flow_history_entities should have been stored on this
// object in the above pre_render method relevant to this record.
if (!empty($this->state_flow_history_entities_by_revision_id[$entity_type][$revision_id])) {
// These are the state_flow_history_entities relevant only to this
// state_flow_states/parent entity revision_id record.
$state_flow_history_entities = $this->state_flow_history_entities_by_revision_id[$entity_type][$revision_id];
// A renderable array.
$output = array();
// Add each state_flow_history_entity to the renderable array.
foreach ($state_flow_history_entities as $hid => $state_flow_history_entity) {
$output[]['#markup'] = state_flow_entity_state_flow_history_entity_view($state_flow_history_entity, $view_mode = 'full');
}
return $output;
}
// Return an empty string if there is a fail above.
return '';
}