Created
August 21, 2012 20:44
-
-
Save rfsbsb/3419279 to your computer and use it in GitHub Desktop.
Campo de preço por metro quadrado computado no Drupal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$area = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_area'))); | |
$preco = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_preco'))); | |
if ($preco > 0) { | |
$entity_field[0]['value'] = number_format(($preco / $area), 2, ',', '.'); | |
} else { | |
$entity_field[0]['value'] = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment