Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function computed_field_field_highest_compute(&$entity_field, $entity_type, $entity, $field, $instance, $langcode, $items) {
- $temps = field_get_items($entity_type, $entity, 'field_temp');
- if (count($temps)) {
- $max = $temps[0]['value'];
- foreach($temps as $temp) {
- $max = $temp['value'] > $max ? $temp['value'] : $max;
- }
- $entity_field[0]['value'] = $max;
- }
- }
- function computed_field_field_lowest_compute(&$entity_field, $entity_type, $entity, $field, $instance, $langcode, $items) {
- $temps = field_get_items($entity_type, $entity, 'field_temp');
- if (count($temps)) {
- $min = $temps[0]['value'];
- foreach($temps as $temp) {
- $min = $temp['value'] < $min ? $temp['value'] : $min;
- }
- $entity_field[0]['value'] = $min;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement