You are here

function field_test_entity_nested_form_submit in Drupal 7

Submit handler for field_test_entity_nested_form().

File

modules/field/tests/field_test.entity.inc, line 472
Defines an entity type.

Code

function field_test_entity_nested_form_submit($form, &$form_state) {
  $entity_1 = (object) $form_state['values'];
  field_attach_submit('test_entity', $entity_1, $form, $form_state);
  field_test_entity_save($entity_1);
  $entity_2 = (object) $form_state['values']['entity_2'];
  field_attach_submit('test_entity', $entity_2, $form['entity_2'], $form_state);
  field_test_entity_save($entity_2);
  drupal_set_message(t('test_entities @id_1 and @id_2 have been updated.', array(
    '@id_1' => $entity_1->ftid,
    '@id_2' => $entity_2->ftid,
  )));
}