You are here

function fieldgroup_panels_edit_fieldgroup in Content Construction Kit (CCK) 5

'Edit' callback for the 'fieldgroup' panel.

1 string reference to 'fieldgroup_panels_edit_fieldgroup'
fieldgroup_panels_content_types in ./fieldgroup.module
Implementation of hook_panels_content_types()

File

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

Code

function fieldgroup_panels_edit_fieldgroup($id, $parents, $conf = array()) {

  // Apply defaults
  if (empty($conf)) {
    $conf = array(
      'title' => '',
      'group' => '',
      'empty' => '',
    );
  }

  // Retrieve the list of all groups on all content types
  $group_list = array();
  $types = fieldgroup_groups(NULL, FALSE, FALSE);

  // Add each group to the list with the content type it is from in parentheses
  foreach ($types as $type) {
    foreach ($type as $group) {
      $group_list[$group['group_name']] = $group['label'] . ' (' . $group['type_name'] . ')';
    }
  }
  $form['type_name'] = array(
    '#type' => 'value',
    '#value' => $group['type_name'],
  );
  $form['group'] = array(
    '#type' => 'select',
    '#title' => t('Fieldgroup'),
    '#options' => $group_list,
    '#default_value' => $conf['group'],
    '#prefix' => '<div class="clear-block no-float">',
    '#suffix' => '</div>',
  );
  $form['empty'] = array(
    '#type' => 'textarea',
    '#title' => 'Empty text',
    '#description' => t('Text to display if group has no data. Note that title will not display unless overridden.'),
    '#rows' => 5,
    '#default_value' => $conf['empty'],
    '#prefix' => '<div class="clear-block no-float">',
    '#suffix' => '</div>',
  );
  return $form;
}