function ds_edit_custom_field_form in Display Suite 7
Same name and namespace in other branches
- 7.2 modules/ds_ui/includes/ds.fields.inc \ds_edit_custom_field_form()
Manage a custom field.
2 string references to 'ds_edit_custom_field_form'
- ds_ajax_add_field in ./
ds.field_ui.inc - Handles ctools modal Add field
- ds_menu in ./
ds.module - Implements hook_menu().
File
- ./
ds.fields.inc, line 235 - Administrative functions for managing custom fields for every entity.
Code
function ds_edit_custom_field_form($form, &$form_state, $custom_field = '') {
$custom_field = ds_shared_form($form, $custom_field);
$form['code'] = array(
'#type' => 'text_format',
'#title' => t('Field code'),
'#default_value' => isset($custom_field->properties['code']['value']) ? $custom_field->properties['code']['value'] : '',
'#format' => isset($custom_field->properties['code']['format']) ? $custom_field->properties['code']['format'] : 'ds_code',
'#base_type' => 'textarea',
'#required' => TRUE,
);
$form['use_token'] = array(
'#type' => 'checkbox',
'#title' => t('Token'),
'#description' => t('Toggle this checkbox if you are using tokens in this field.'),
'#default_value' => isset($custom_field->properties['use_token']) ? $custom_field->properties['use_token'] : '',
);
// Token support.
if (module_exists('token')) {
$form['tokens'] = array(
'#title' => t('Tokens'),
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#states' => array(
'invisible' => array(
'input[name="use_token"]' => array(
'checked' => FALSE,
),
),
),
);
$form['tokens']['help'] = array(
'#theme' => 'token_tree',
'#token_types' => 'all',
'#global_types' => FALSE,
'#dialog' => TRUE,
);
}
else {
$form['use_token']['#description'] = t('Toggle this checkbox if you are using tokens in this field. If the token module is installed, you get a nice list of all tokens available in your site.');
}
$form['#validate'][] = 'ds_custom_field_form_validate';
return $form;
}