Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / field_attach_submit.twig
1 /**
2  * Implements hook_field_attach_submit().
3  */
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);
10   }
11 }