From 8d2b35a6c4d4b0c31232cf7408f92db3d00c9735 Mon Sep 17 00:00:00 2001 From: Ryan Jacobs Date: Tue, 22 Jan 2013 16:30:52 -0600 Subject: [PATCH] Issue #1883156: Pass entity to custom display function. --- computed_field.module | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/computed_field.module b/computed_field.module index c7bff05..2236be1 100644 --- a/computed_field.module +++ b/computed_field.module @@ -89,7 +89,7 @@ function computed_field_field_settings_form($field, $instance, $has_data) { $form['display_format'] = array( '#type' => 'textarea', '#title' => t('Display Code (PHP)'), - '#description' => t('This code should assign a string to the @display_output variable, which will be printed when the field is displayed. The raw computed value of the field is in @value. Note: this code has no effect if you use the "Raw computed value" display formatter.

Alternately, this code can be supplied by your own custom function named: @display_func($field, $entity_field_item, $entity_lang, $langcode). Return the value to be displayed. Original value is in $entity_field_item[\'value\'].', + '#description' => t('This code should assign a string to the @display_output variable, which will be printed when the field is displayed. The raw computed value of the field is in @value. Note: this code has no effect if you use the "Raw computed value" display formatter.

Alternately, this code can be supplied by your own custom function named: @display_func($field, $entity_field_item, $entity_lang, $langcode, $entity). Return the value to be displayed. Original value is in $entity_field_item[\'value\'].', array('@display_output' => '$display_output', '@value' => '$entity_field_item[\'value\']', '@display_func' => $display_func)), @@ -338,7 +338,7 @@ function computed_field_field_formatter_view($entity_type, $entity, $field, $ins // Execute the display code $display_output = NULL; if ($display_in_code) { - $display_output = $display_func($field, $entity_field_item, $entity_lang, $langcode); + $display_output = $display_func($field, $entity_field_item, $entity_lang, $langcode, $entity); } else { eval($field['settings']['display_format']); -- 1.7.7.5 (Apple Git-26)