function _field_filter_items

Helper function to filter out empty field values.


$field: The field definition.

$items: The field values to filter.

Return value

The array of items without empty field values. The function also renumbers the array keys to ensure sequential deltas.

Related topics

2 calls to _field_filter_items()
field_default_submit in drupal/modules/field/
field_default_validate in drupal/modules/field/
Generic field validation handler.


drupal/modules/field/field.module, line 509
Attach custom data fields to Drupal entities.


function _field_filter_items($field, $items) {
  $function = $field['module'] . '_field_is_empty';
  foreach ((array) $items as $delta => $item) {

    // Explicitly break if the function is undefined.
    if ($function($item, $field)) {
  return array_values($items);