function chado_views_handler_field::render_field
3.x chado_views_handler_field.inc | chado_views_handler_field::render_field($entity, $field_name, $row_id) |
Render the field for display in the view.
Parameters
TripalEntity $entity: The entity containing the field to be rendered.
string $field_name: The name of the field to render.
integer $row_id: The id of the row this field will be displayed in.
Return value
string The rendered field.
1 call to chado_views_handler_field::render_field()
- chado_views_handler_field::post_execute in tripal_chado/
views_handlers/ chado_views_handler_field.inc - Load the entities for all fields that are about to be displayed.
File
- tripal_chado/
views_handlers/ chado_views_handler_field.inc, line 92
Class
- chado_views_handler_field
- Views Field Handler for chado fields. Uses the same approach as the field api views_handler_field_field.
Code
function render_field($entity, $field_name, $row_id) {
$display = array(
'type' => $this->options['type'],
'settings' => (isset($this->options['settings'])) ? $this->options['settings'] : array(),
'label' => 'hidden',
// Pass the View object in the display so that fields can act on it.
'views_view' => $this->view,
'views_field' => $this,
'views_row_id' => $row_id,
);
$langcode = LANGUAGE_NONE;
$items = field_get_items($entity->type, $entity, $field_name);
if (count($items) == 1) {
$render_array = field_view_value($entity->type, $entity, $field_name, $items[0], $display, $langcode);
}
// @todo: handle fields with multiple values.
else {
$render_array = field_view_value($entity->type, $entity, $field_name, $items[0], $display, $langcode);
drupal_set_message('Tripal Chado currently only supports views integration for single value fields. The first value has been shown.', 'warning');
}
return $render_array;
}