function _ds_field_ui_custom_fields in Display Suite 7
Same name and namespace in other branches
- 7.2 includes/ds.field_ui.inc \_ds_field_ui_custom_fields()
Add tab for adding new fields on the fly.
Parameters
$entity_type: The name of the entity type.
$bundle: The name of the bundle
$view_mode: The name of the view_mode
$form: A collection of form properties.
$form_state: A collection of form_state properties.
1 call to _ds_field_ui_custom_fields()
- ds_field_ui_fields_layouts in ./
ds.field_ui.inc - Adds the Display Suite fields and layouts to the form.
File
- ./
ds.field_ui.inc, line 1682 - Field UI functions for Display Suite.
Code
function _ds_field_ui_custom_fields($entity_type, $bundle, $view_mode, &$form, $form_state) {
$form['additional_settings']['add_custom_fields'] = array(
'#type' => 'fieldset',
'#title' => t('Add custom fields'),
'#description' => t('Click on one of the buttons to create a new field.') . '<p></p>',
'#access' => user_access('admin_fields'),
);
// Include the CTools tools that we need.
ctools_include('ajax');
ctools_include('modal');
// Add CTools' javascript to the page.
ctools_modal_add_js();
$field_types = array(
'custom_field' => t('Add a code field'),
'manage_ctools' => t('Add a dynamic field'),
);
if (module_exists('block')) {
$field_types['manage_block'] = t('Add a block field');
}
$field_types['manage_preprocess'] = t('Add a preprocess field');
foreach ($field_types as $field_key => $field_title) {
$form['ctools_add_field_' . $field_key . '_url'] = array(
'#type' => 'hidden',
'#attributes' => array(
'class' => array(
'ctools_add_field_' . $field_key . '-url',
),
),
'#value' => url('admin/structure/ds/nojs/add_field/' . $field_key),
);
$form['additional_settings']['add_custom_fields']['ctools_add_field_' . $field_key] = array(
'#type' => 'button',
'#value' => $field_title,
'#attributes' => array(
'class' => array(
'ctools-use-modal',
),
),
'#id' => 'ctools_add_field_' . $field_key,
);
}
}