You are here

public function state_flow_entity_handler_field_link::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_link.inc, line 52
Field handler that provides actionable links related to an entity version.

Class

state_flow_entity_handler_field_link
@file Field handler that provides actionable links related to an entity version.

Code

public function render($values) {

  // Make sure these options are set.
  if (!empty($this->aliases['active']) && !empty($this->options['active_revision_handling'])) {
    $active_revision_handling = $this->options['active_revision_handling'];
    $active_alias = $this->aliases['active'];

    // If 'active' matters, then check the active column if necessary.
    if ($active_revision_handling === 'both' || $active_revision_handling === 'active' && !empty($values->{$active_alias}) || $active_revision_handling === 'inactive' && empty($values->{$active_alias})) {

      // Verify that link text and type are set.
      if (!empty($this->options['link_text']) && !empty($this->options['link_type'])) {
        return $this
          ->render_state_flow_states_link($values, check_plain($this->options['link_text']), $this->options['link_type']);
      }
    }
  }
}