function ds_sync_copy_form in Display Suite 6
Same name and namespace in other branches
- 6.3 includes/ds.display.inc \ds_sync_copy_form()
- 6.2 includes/ds.display.inc \ds_sync_copy_form()
Add the sync / copy tab to the display overview form.
Parameters
$form The display form.:
array $display_settings Current display settings.:
array $current_build_mode Current build mode.:
string $module The current module.:
string $type_name The name of the type.:
1 call to ds_sync_copy_form()
- ds_display_overview_form in includes/
ds.display.inc - Menu callback; presents a listing of fields display settings for an object type.
File
- includes/
ds.display.inc, line 407 - Display overview form.
Code
function ds_sync_copy_form(&$form, $display_settings, $current_build_mode, $module, $type_name) {
$copy = array();
$sync = array();
$build_modes = array();
$all_build_modes = ds_get_build_modes($module);
$exclude_build_modes = variable_get($module . '_buildmodes_exclude', array());
foreach ($all_build_modes as $key => $build_mode) {
$excluded = isset($exclude_build_modes[$type_name][$key]) && $exclude_build_modes[$type_name][$key] == TRUE ? TRUE : FALSE;
if ($excluded || $key == $current_build_mode) {
continue;
}
$copy[$key] = $build_mode['title'];
$sync[$key] = t('Keep synchronized');
}
if (!empty($copy)) {
$form['sync_copy'] = array(
'#type' => 'fieldset',
'#description' => t('Copy once or always sync display and plugin settings with other build modes. Syncing options are not saved bi-directional.<br />Watch out when copying field settings to another build mode which has a different set of regions as you can loose some fields for display. A typical example is RSS which only has one region (middle).'),
);
$form['sync_copy']['info'] = array(
'#type' => 'item',
'#value' => t('Copy "!current" to', array(
'!current' => $all_build_modes[$current_build_mode]['title'],
)),
'#prefix' => '<div style="float: left; margin-right: 10px;">',
'#suffix' => '</div>',
);
$form['sync_copy']['copy'] = array(
'#type' => 'checkboxes',
'#options' => $copy,
'#prefix' => '<div style="float: left; margin-right: 30px; margin-top: 10px;">',
'#suffix' => '</div>',
);
$form['sync_copy']['sync'] = array(
'#type' => 'checkboxes',
'#options' => $sync,
'#default_value' => isset($display_settings[$current_build_mode]['sync']) ? $display_settings[$current_build_mode]['sync'] : array(),
'#prefix' => '<div style="float: left; margin-top: 10px;">',
'#suffix' => '</div>',
);
}
}