function field_test_entity_form_submit

Submit handler for field_test_entity_form().

File

modules/field/tests/field_test.entity.inc, line 393

Code

function field_test_entity_form_submit($form, &$form_state) {
    $entity = field_test_entity_form_submit_build_test_entity($form, $form_state);
    $insert = empty($entity->ftid);
    field_test_entity_save($entity);
    $message = $insert ? t('test_entity @id has been created.', array(
        '@id' => $entity->ftid,
    )) : t('test_entity @id has been updated.', array(
        '@id' => $entity->ftid,
    ));
    drupal_set_message($message);
    if ($entity->ftid) {
        $form_state['redirect'] = 'test-entity/manage/' . $entity->ftid . '/edit';
    }
    else {
        // Error on save.
        drupal_set_message(t('The entity could not be saved.'), 'error');
        $form_state['rebuild'] = TRUE;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.