function ds_build_mode_form in Display Suite 6.2
Same name and namespace in other branches
- 6.3 includes/ds.buildmodes.inc \ds_build_mode_form()
- 6 includes/ds.buildmodes.inc \ds_build_mode_form()
Build mode form.
Parameters
string $form_state: The form
string $module: The name of the module.
string $build_mode: The name of the build mode.
1 string reference to 'ds_build_mode_form'
- ds_build_modes_page in includes/
ds.buildmodes.inc - Build modes overview.
File
- includes/
ds.buildmodes.inc, line 121 - Manage build modes.
Code
function ds_build_mode_form($form_state, $module, $build_mode = '') {
$form = array();
if (!empty($build_mode)) {
$build_modes = variable_get($module . '_build_modes', array());
$title = $build_modes[$build_mode];
}
else {
$title = '';
}
$form['identity'] = array(
'#type' => 'fieldset',
'#title' => empty($build_mode) ? t('Add new build mode') : t('Update build mode'),
'#collapsible' => FALSE,
'#collapsed' => FALSE,
);
$form['identity']['key'] = array(
'#type' => 'textfield',
'#title' => 'Key name',
'#description' => t('The machine-readable name of this build mode.'),
'#required' => TRUE,
'#maxlength' => 32,
);
if (!empty($build_mode)) {
$form['identity']['key']['#disabled'] = TRUE;
$form['identity']['key']['#value'] = $build_mode;
$form['identity']['key']['#description'] = t('The machine-readable name of this build mode. Note: you can not edit this key.');
}
$form['identity']['name'] = array(
'#type' => 'textfield',
'#title' => 'Display name',
'#description' => t('The name of this build mode which will be used for every type on the display fields page.'),
'#required' => TRUE,
'#default_value' => $title,
);
$form['identity']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save build mode'),
'#submit' => array(
'ds_build_mode_form_submit',
),
);
$form['#module'] = $module;
$form['#form_type'] = empty($build_mode) ? 'insert' : 'update';
return $form;
}