1 entity.class.inc public Entity::getFieldValues($field_name, $value_key = 'value', $langcode = NULL)

Implements EntityInterface::getFieldValues().

Overrides EntityInterface::getFieldValues

File

core/modules/entity/entity.class.inc, line 350
Provides an interface and a base class for entities.

Class

Entity
Defines a base entity class.

Code

public function getFieldValues($field_name, $value_key = 'value', $langcode = NULL) {
  $values = array();
  if ($field_items = field_get_items($this->entityType(), $this, $field_name, $langcode)) {
    foreach ($field_items as $item) {
      if (isset($item[$value_key])) {
        $values[] = $item[$value_key];
      }
    }
  }
  return $values;
}