function field_test_entity_form_submit in SimpleTest 7
Submit handler for field_test_set_field_values().
File
- tests/
field_test.module, line 316
Code
function field_test_entity_form_submit($form, &$form_state) {
$entity = field_test_entity_form_submit_builder($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) {
unset($form_state['rebuild']);
$form_state['redirect'] = 'test-entity/' . $entity->ftid . '/edit';
}
else {
// Error on save.
drupal_set_message(t('The entity could not be saved.'), 'error');
}
}