You are here

public static function EntityFieldHandlerHelper::render_single_value in Entity API 7

Render a single value.

Parameters

$handler: The field handler whose field is rendered.

$value: The single value to render.

$values: The values for the current row retrieved from the Views query, as an object.

Return value

string The rendered value.

1 call to EntityFieldHandlerHelper::render_single_value()
EntityFieldHandlerHelper::render_entity_link in views/handlers/entity_views_field_handler_helper.inc
Render a single value as a link to the entity if applicable.

File

views/handlers/entity_views_field_handler_helper.inc, line 515
Contains the EntityFieldHandlerHelper class.

Class

EntityFieldHandlerHelper
Helper class containing static implementations of common field handler methods.

Code

public static function render_single_value($handler, $value, $values) {

  // Try to use the method in the specific field handler.
  if (method_exists($handler, 'render_single_value')) {
    $handler->current_value = $value;
    $return = $handler
      ->render_single_value($value, $values);
    unset($handler->current_value);
    return $return;
  }

  // Default fallback in case the field handler doesn't provide the method.
  return is_scalar($value) ? check_plain($value) : nl2br(check_plain(print_r($value, TRUE)));
}