You are here

function content_content_extra_fields in Content Construction Kit (CCK) 6

Same name and namespace in other branches
  1. 6.3 content.module \content_content_extra_fields()
  2. 6.2 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 1909
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,
      'weight' => -5,
    );
  }
  if ($type->has_body) {
    $extra['body_field'] = array(
      'label' => $type->body_label,
      'weight' => 0,
      'view' => 'body',
    );
  }
  if (module_exists('locale') && variable_get("language_{$type_name}", 0)) {
    $extra['language'] = array(
      'label' => t('Language'),
      'weight' => 0,
    );
  }
  if (module_exists('taxonomy') && taxonomy_get_vocabularies($type_name)) {
    $extra['taxonomy'] = array(
      'label' => t('Taxonomy'),
      'weight' => -3,
    );
  }
  if (module_exists('upload') && variable_get("upload_{$type_name}", TRUE)) {
    $extra['attachments'] = array(
      'label' => t('File attachments'),
      'weight' => 30,
      'view' => 'files',
    );
  }
  return $extra;
}