2 * Implements hook_field_attach_submit().
4 function {{ machine_name }}_field_attach_submit($entity_type, $entity, $form, &$form_state) {
5 // Sample case of an 'Empty the field' checkbox added on the form, allowing
6 // a given field to be emptied.
7 $values = drupal_array_get_nested_value($form_state['values'], $form['#parents']);
8 if (!empty($values['empty_field_foo'])) {
9 unset($entity->field_foo);