Skip to content

Instantly share code, notes, and snippets.

@amitaibu
Created May 29, 2013 12:43
Show Gist options
  • Save amitaibu/5670004 to your computer and use it in GitHub Desktop.
Save amitaibu/5670004 to your computer and use it in GitHub Desktop.
$dummy_form_state = $form_state;
if (empty($form_state['rebuild'])) {
// Form is "fresh" (i.e. not call from field_add_more_submit()), so
// re-set the items-count, to show the correct amount for the mocked
// instance.
$dummy_form_state['field'][$field_name][LANGUAGE_NONE]['items_count'] = !empty($dummy_entity->{$field_name}[LANGUAGE_NONE]) ? count($dummy_entity->{$field_name}[LANGUAGE_NONE]) : 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment