Calling all Drupal developers!
Help us get this on the first page of Digg. DIGG NOW!
Help us get this on the first page of Digg. DIGG NOW!
fieldgroup_edit_group_form($content_type, $group_name, $action)
contributions/cck/fieldgroup.module, line 55
<?php
function fieldgroup_edit_group_form($content_type, $group_name, $action) {
$groups = fieldgroup_groups($content_type['type']);
$group = $groups[$group_name];
if ($action == 'add') {
//adding a new one
$group = array();
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Add'),
'#weight' => 10,
);
}
else if ($group) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#weight' => 10,
);
}
else {
drupal_not_found();
exit;
}
$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Label'),
'#default_value' => $group['label'],
'#required' => TRUE,
);
$form['settings']['#tree'] = TRUE;
$form['settings']['form'] = array(
'#type' => 'fieldset',
'#title' => 'Form settings',
'#description' => t('These settings apply to the group in the node editing form'),
);
$form['settings']['form']['style'] = array(
'#type' => 'radios',
'#title' => t('Style'),
'#default_value' => $group['settings']['form']['style'] ? $group['settings']['form']['style'] : 'fieldset',
'#options' => array(
'fieldset' => t('always open'),
'fieldset_collapsible' => t('collapsible'),
'fieldset_collapsed' => t('collapsed'),
)
);
$form['settings']['form']['description'] = array(
'#type' => 'textarea',
'#title' => t('Help text'),
'#default_value' => $group['settings']['form']['description'],
'#rows' => 5,
'#description' => t('Instructions to present to the user on the editing form.'),
'#required' => FALSE,
);
$form['settings']['display'] = array(
'#type' => 'fieldset',
'#title' => 'Display settings',
'#description' => t('These settings apply to the group on node display.'),
);
$form['settings']['display']['description'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#default_value' => $group['settings']['display']['description'],
'#rows' => 5,
'#description' => t('A description of the group.'),
'#required' => FALSE,
);
foreach (array_merge(array_keys(_content_admin_display_contexts()), array('label')) as $key) {
$form['settings']['display'][$key] = array('#type' => 'value', '#value' => $group['settings']['display'][$key]);
}
$form['weight'] = array('#type' => 'hidden', '#default_value' => $group['weight']);
$form['group_name'] = array('#type' => 'hidden', '#default_value' => $group_name);
$form['#submit'] = array('fieldgroup_edit_group_submit' => array($content_type, $action));
return $form;
}
?>