I am using a computed field and I want to display the field_first_name and field_last_name, which are properties of the user that created that node.
I have been trying things, but it seems like $entity does not have a uid?
I have no idea how to get load the user. These are the variables I have:
The variables available to your code include: &$entity_field, $entity_type, $entity, $field, $instance, $langcode, and $items. To set the value of the field, set $entity_field['value']. For multi-value computed fields continue with $entity_field['value']. Here's a simple example which sets the computed field's value to the value of the sum of the number fields (field_a and field_b) in a node entity: $entity_field['value'] = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_a'))) + array_pop(array_pop(field_get_items($entity_type, $entity, 'field_b'))); The first pop fetches the last (or only) item from the field while the second pop fetches its ['value'] contents (assuming it's the only key that's set).