You are here

function content_content_extra_fields in Content Construction Kit (CCK) 6.2

Same name and namespace in other branches
  1. 6.3 content.module \content_content_extra_fields()
  2. 6 content.module \content_content_extra_fields()

Implementation of hook_content_extra_fields.

Informations for non-CCK 'node fields' defined in core.

File

./content.module, line 2454
Allows administrators to associate custom fields to content types.

Code

function content_content_extra_fields($type_name) {
  $type = node_get_types('type', $type_name);
  $extra = array();
  if ($type->has_title) {
    $extra['title'] = array(
      'label' => $type->title_label,
      'description' => t('Node module form.'),
      'weight' => -5,
    );
  }
  if ($type->has_body) {
    $extra['body_field'] = array(
      'label' => $type->body_label,
      'description' => t('Node module form.'),
      'weight' => 0,
      'view' => 'body',
    );
  }
  $extra['revision_information'] = array(
    'label' => t('Revision information'),
    'description' => t('Node module form.'),
    'weight' => 20,
  );
  $extra['author'] = array(
    'label' => t('Authoring information'),
    'description' => t('Node module form.'),
    'weight' => 20,
  );
  $extra['options'] = array(
    'label' => t('Publishing options'),
    'description' => t('Node module form.'),
    'weight' => 25,
  );
  if (module_exists('comment')) {
    $extra['comment_settings'] = array(
      'label' => t('Comment settings'),
      'description' => t('Comment module form.'),
      'weight' => 30,
    );
  }
  if (module_exists('locale') && variable_get("language_content_type_{$type_name}", 0)) {
    $extra['language'] = array(
      'label' => t('Language'),
      'description' => t('Locale module form.'),
      'weight' => 0,
    );
  }
  if (module_exists('translation') && translation_supported_type($type_name)) {
    $extra['translation'] = array(
      'label' => t('Translation settings'),
      'description' => t('Translation module form.'),
      'weight' => 30,
    );
  }
  if (module_exists('menu')) {
    $extra['menu'] = array(
      'label' => t('Menu settings'),
      'description' => t('Menu module form.'),
      'weight' => -2,
    );
  }
  if (module_exists('taxonomy') && taxonomy_get_vocabularies($type_name)) {
    $extra['taxonomy'] = array(
      'label' => t('Taxonomy'),
      'description' => t('Taxonomy module form.'),
      'weight' => -3,
    );
  }
  if (module_exists('book')) {
    $extra['book'] = array(
      'label' => t('Book'),
      'description' => t('Book module form.'),
      'weight' => 10,
    );
  }
  if (module_exists('path')) {
    $extra['path'] = array(
      'label' => t('Path settings'),
      'description' => t('Path module form.'),
      'weight' => 30,
    );
  }
  if ($type_name == 'poll' && module_exists('poll')) {
    $extra['title'] = array(
      'label' => t('Poll title'),
      'description' => t('Poll module title.'),
      'weight' => -5,
    );
    $extra['choice_wrapper'] = array(
      'label' => t('Poll choices'),
      'description' => t('Poll module choices.'),
      'weight' => -4,
    );
    $extra['settings'] = array(
      'label' => t('Poll settings'),
      'description' => t('Poll module settings.'),
      'weight' => -3,
    );
  }
  if (module_exists('upload') && variable_get("upload_{$type_name}", TRUE)) {
    $extra['attachments'] = array(
      'label' => t('File attachments'),
      'description' => t('Upload module form.'),
      'weight' => 30,
      'view' => 'files',
    );
  }
  return $extra;
}