If you are getting a field for output in a theme, most of the time you will want to use display() instead.
This function will return arrays for relationship and file fields.
public field ( string | array $name, boolean $single = null, boolean $raw = false ) : mixed | null | ||
$name | string | array | The field name, or an associative array of parameters |
$single | boolean | (optional) For tableless fields, to return the whole array or the just the first item, or an associative array of parameters |
$raw | boolean | (optional) Whether to return the raw value, or to run through the field type's display method, or an associative array of parameters |
return | mixed | null | Value returned depends on the field type, null if the field doesn't exist, false if no value returned for tableless fields |