function field_test_entity_form in SimpleTest 7
Form to set the value of fields attached to our entity.
2 string references to 'field_test_entity_form'
- field_test_entity_add in tests/
field_test.module - field_test_entity_edit in tests/
field_test.module
File
- tests/
field_test.module, line 272
Code
function field_test_entity_form($form, &$form_state, $entity) {
if (isset($form_state['test_entity'])) {
$entity = $form_state['test_entity'] + (array) $entity;
}
$entity = (object) $entity;
foreach (array(
'ftid',
'ftvid',
'fttype',
) as $key) {
$form[$key] = array(
'#type' => 'value',
'#value' => isset($entity->{$key}) ? $entity->{$key} : NULL,
);
}
// Add field widgets.
$form['#builder_function'] = 'field_test_entity_form_submit_builder';
field_attach_form('test_entity', $entity, $form, $form_state);
$form['revision'] = array(
'#access' => user_access('administer field_test content'),
'#type' => 'checkbox',
'#title' => t('Create new revision'),
'#default_value' => FALSE,
'#weight' => 100,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#weight' => 101,
);
return $form;
}