You are here

function content_panels_edit_field in Content Construction Kit (CCK) 5

1 string reference to 'content_panels_edit_field'
content_panels_content_types in ./content_panels.inc
Implementation of hook_panels_content_types()

File

./content_panels.inc, line 42

Code

function content_panels_edit_field($id, $parents, $conf = array()) {
  $form = array();
  $form['label'] = array(
    '#type' => 'select',
    '#title' => t('Label'),
    '#default_value' => $conf['label'],
    '#options' => array(
      'normal' => t('Block title'),
      'above' => t('Above'),
      'inline' => t('Inline'),
      'hidden' => t('hidden'),
    ),
    '#description' => t('Configure how the label is going to be displayed'),
  );
  $options = array(
    '' => '',
  );
  $fields = content_fields();
  $field_types = _content_field_types();
  foreach ($fields as $field_name => $field) {
    $type_info = $field_types[$field['type']];
    foreach ($type_info['formatters'] as $formatter_name => $formatter) {
      $label = $type_info['label'] . ':' . $field['widget']['label'];
      $label .= $field['widget']['label'] != $field_name ? ' (' . $field_name . ')' : '';
      $options[$label][$field_name . ':' . $formatter_name] = $formatter['label'];
    }
  }
  ksort($options);
  $form['field_formatter'] = array(
    '#type' => 'select',
    '#title' => t('Field / Formatter'),
    '#default_value' => $conf['field_formatter'],
    '#options' => $options,
    '#description' => t('Select a field and formatter.'),
    '#required' => TRUE,
  );
  return $form;
}