function multifield_edit_form in Multifield 7.2
Same name and namespace in other branches
- 7 multifield.admin.inc \multifield_edit_form()
1 string reference to 'multifield_edit_form'
- multifield_menu in ./
multifield.module - Implements hook_menu().
File
- ./
multifield.admin.inc, line 84 - Administation pages and forms for the Multifield module.
Code
function multifield_edit_form($form, &$form_state, $multifield = NULL) {
if (!isset($multifield)) {
$multifield = (object) array(
'mfid' => NULL,
'machine_name' => NULL,
'label' => NULL,
'description' => NULL,
);
}
$form['mfid'] = array(
'#type' => 'value',
'#value' => !empty($multifield->mfid) ? $multifield->mfid : NULL,
);
$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Label'),
'#description' => t('This will appear in the administrative interface to easily identify it.'),
'#default_value' => $multifield->label,
'#required' => TRUE,
'#maxlength' => 255,
);
$form['machine_name'] = array(
'#type' => 'machine_name',
'#title' => t('Machine name'),
'#description' => t('The unique ID for this multifield type.'),
'#default_value' => $multifield->machine_name,
'#required' => TRUE,
'#machine_name' => array(
'exists' => 'multifield_field_machine_name_exists',
'label' => t('Field type machine name'),
'source' => array(
'label',
),
),
// Same maximum length as {field_config}.type
'#maxlength' => 128,
// Cannot change the machine name once created.
'#disabled' => !empty($multifield->machine_name),
);
$form['description'] = array(
'#type' => 'textfield',
'#title' => t('Description'),
'#default_value' => $multifield->machine_name,
'#access' => FALSE,
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['save'] = array(
'#type' => 'submit',
'#value' => !empty($multifield->is_new) ? t('Save and add subfields') : t('Save'),
);
$form['actions']['cancel'] = array(
'#type' => 'link',
'#title' => t('Cancel'),
'#href' => 'admin/structure/multifield',
);
return $form;
}