1 entity.class.inc | public EntityInterface::getFieldValue($field_name, $value_key = 'value', $langcode = NULL) |
Returns a single value from a field on the entity.
@since 1.13.0 Method added.
Parameters
string $field_name: The machine name of the field.
string $value_key: The key indicating the primary data value for the field. Defaults to 'value' which is used in both text and number fields. For fields which do not have a 'value' key such as terms (which use a 'tid' key) or files (which use a 'fid' key), the key must be specified.
string $langcode (optional): The language code for the requested language. Defaults to the current language.
Return value
(array): All field values, or an empty array if the field is empty, if the field does not contain the $value_key specified, or if the entity does not contain the $field_name specified.
File
- core/
modules/ entity/ entity.class.inc, line 186 - Provides an interface and a base class for entities.
Class
- EntityInterface
- Defines a common interface for all entity objects.
Code
public function getFieldValue($field_name, $value_key = 'value', $langcode = NULL);