You are here

function content_content_field_content_type_content_types in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6.2 includes/panels/content_types/content_field.inc \content_content_field_content_type_content_types()

Return all field content types available.

1 call to content_content_field_content_type_content_types()
content_content_field_content_type_content_type in includes/panels/content_types/content_field.inc
Just one subtype.

File

includes/panels/content_types/content_field.inc, line 22
This file provides a CTools content type for fields.

Code

function content_content_field_content_type_content_types() {

  // This will hold all the individual field content types.
  $types = array();

  // Get all fields on the site.
  $field_types = _content_field_types();
  foreach (content_types() as $type_name => $type) {
    foreach ($type['fields'] as $field_name => $field) {
      if (!isset($types[$field_name])) {
        $types[$field_name] = array(
          'category' => t('Node'),
          'icon' => 'icon_cck_field.png',
          'title' => t('Field: @widget_label (@field_name) - @field_type', array(
            '@widget_label' => t($field['widget']['label']),
            '@field_name' => $field_name,
            '@field_type' => t($field_types[$field['type']]['label']),
          )),
          'description' => t('Field on the referenced node.'),
          'types' => array(),
        );
        if (isset($field_types[$field['type']]['content_icon'])) {
          $types[$field_name]['icon'] = $field_types[$field['type']]['content_icon'];
        }
      }
      $types[$field_name]['types'][$type_name] = $type['name'];
    }
  }

  // Create the required context for each field related to the content types.
  foreach ($types as $field_name => $field_content_type) {
    $types[$field_name]['required context'] = new ctools_context_required(t('Node'), 'node', array(
      'type' => array_keys($types[$field_name]['types']),
    ));
    unset($types[$field_name]['types']);
  }
  return $types;
}