You are here

function content_existing_field_options in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6.2 includes/content.admin.inc \content_existing_field_options()

Return an array of existing field to be added to a node type.

2 calls to content_existing_field_options()
content_field_overview_form in includes/content.admin.inc
Menu callback; listing of fields for a content type.
template_preprocess_content_field_overview_form in theme/theme.inc
@file Theme preprocess function for content-admin-field-overview-form.tpl.php.

File

includes/content.admin.inc, line 790
Administrative interface for content type creation.

Code

function content_existing_field_options($type_name) {
  $type = content_types($type_name);
  $fields = content_fields();
  $field_types = _content_field_types();
  $options = array();
  foreach ($fields as $field) {
    if (!isset($type['fields'][$field['field_name']]) && !$field['locked']) {
      $field_type = $field_types[$field['type']];
      $text = t('@type: @field (@label)', array(
        '@type' => t($field_type['label']),
        '@label' => t($field['widget']['label']),
        '@field' => $field['field_name'],
      ));
      $options[$field['field_name']] = drupal_strlen($text) > 80 ? truncate_utf8($text, 77) . '...' : $text;
    }
  }

  // Sort the list by type, then by field name, then by label.
  asort($options);
  return $options;
}