You are here

function fieldgroup_group_edit_form in Content Construction Kit (CCK) 6.2

Same name and namespace in other branches
  1. 6.3 modules/fieldgroup/fieldgroup.module \fieldgroup_group_edit_form()
4 string references to 'fieldgroup_group_edit_form'
content_copy_export in modules/content_copy/content_copy.module
Process the export, get field admin forms for all requested fields and save the form values as formatted text.
content_copy_form_alter in modules/content_copy/content_copy.module
Implementation of hook_form_alter(). Intervene to run form through macro when doing export
content_copy_record_macro in modules/content_copy/content_copy.module
A handler that stores the form submissions into a $GLOBALS array
fieldgroup_menu in modules/fieldgroup/fieldgroup.module
Implementation of hook_menu().

File

modules/fieldgroup/fieldgroup.module, line 102
Create field groups for CCK fields.

Code

function fieldgroup_group_edit_form(&$form_state, $type_name, $group_name) {
  $content_type = content_types($type_name);
  $groups = fieldgroup_groups($content_type['type']);
  if (!($group = $groups[$group_name])) {
    drupal_not_found();
    exit;
  }
  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => t('Label'),
    '#default_value' => $group['label'],
    '#required' => TRUE,
  );

  // Set a default value for group type early in the form so it
  // can be overridden by subsequent form elements added by other modules.
  $group_type = !empty($group['group_type']) ? $group['group_type'] : 'standard';
  $form['group_type'] = array(
    '#type' => 'hidden',
    '#default_value' => $group_type,
  );
  $form['settings']['#tree'] = TRUE;
  $form['settings']['form'] = array(
    '#type' => 'fieldset',
    '#title' => t('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'],
    '#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' => t('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_keys(content_build_modes()) as $key) {
    $form['settings']['display'][$key]['format'] = array(
      '#type' => 'value',
      '#value' => isset($group['settings']['display'][$key]['format']) ? $group['settings']['display'][$key]['format'] : 'fieldset',
    );
    $form['settings']['display'][$key]['exclude'] = array(
      '#type' => 'value',
      '#value' => isset($group['settings']['display'][$key]['exclude']) ? $group['settings']['display'][$key]['exclude'] : 0,
    );
  }
  $form['settings']['display']['label'] = array(
    '#type' => 'value',
    '#value' => $group['settings']['display']['label'],
  );
  $form['weight'] = array(
    '#type' => 'hidden',
    '#default_value' => $group['weight'],
  );
  $form['group_name'] = array(
    '#type' => 'hidden',
    '#default_value' => $group_name,
  );
  $form['#content_type'] = $content_type;
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#weight' => 10,
  );
  return $form;
}