You are here

public static function FieldHelper::getValues in Helper 7

5 calls to FieldHelper::getValues()
FieldHelper::extractValues in lib/FieldHelper.php
FieldHelper::getFieldEntities in lib/FieldHelper.php
FieldHelper::getValue in lib/FieldHelper.php
FieldHelper::getValueDelta in lib/FieldHelper.php
FieldHelperTestCase::testValues in tests/FieldHelperTestCase.test

File

lib/FieldHelper.php, line 5

Class

FieldHelper

Code

public static function getValues($entity_type, $entity, $field_name, $column = NULL) {
  if (!empty($entity->{$field_name}) && ($items = field_get_items($entity_type, $entity, $field_name))) {
    if (isset($column)) {
      $value_parents = is_array($column) ? $column : array(
        $column,
      );
      $items = ArrayHelper::extractNestedValuesToArray($items, $value_parents);
    }
    return $items;
  }
  return array();
}