public static function EntityHelper::removeEmptyFieldValues in Helper 7
Remove the empty field values from an entity.
We run this on migrations because empty field values are only removed when an entity is submitted via the UI and forms, and not programmatically.
Parameters
string $entity_type: An entity type.
object $entity: An entity object.
File
- lib/
EntityHelper.php, line 134
Class
Code
public static function removeEmptyFieldValues($entity_type, $entity) {
// Invoke field_default_submit() which will filter out empty field values.
$form = $form_state = array();
_field_invoke_default('submit', $entity_type, $entity, $form, $form_state);
}