You are here

function _entityreference_autofill_field_array_value_exists in Entity reference autofill 7

Recursive check if a field already has a set value.

@todo Not sure how good this works, neither if there's a more efficient/clean way of doing it.

Parameters

string $field_input: Array of field input values.

Return value

bool Wheter or not the field has a value set.

1 call to _entityreference_autofill_field_array_value_exists()
_entityreference_autofill_field_has_value in ./entityreference_autofill.module
Check if a field has an input value.

File

./entityreference_autofill.module, line 470
Entity reference autofill module.

Code

function _entityreference_autofill_field_array_value_exists($field_input) {
  if (is_array($field_input)) {
    foreach ($field_input as $value) {
      if (_entityreference_autofill_field_array_value_exists($value)) {
        return TRUE;
      }
    }
  }
  else {
    return !empty($field_input);
  }
}