function ctools_entity_form_field_content_type_content_types

Return all field content types available.

1 call to ctools_entity_form_field_content_type_content_types()
ctools_entity_form_field_content_type_content_type in plugins/content_types/form/entity_form_field.inc
Just one subtype.

File

plugins/content_types/form/entity_form_field.inc, line 31

Code

function ctools_entity_form_field_content_type_content_types() {
    // This will hold all the individual field content types.
    $types =& drupal_static(__FUNCTION__);
    if (isset($types)) {
        return $types;
    }
    $types = array();
    $content_types = array();
    $entities = entity_get_info();
    $field_instances = field_info_instances();
    foreach ($entities as $entity_type => $entity) {
        foreach ($entity['bundles'] as $type => $bundle) {
            if (!isset($field_instances[$entity_type][$type])) {
                continue;
            }
            foreach ($field_instances[$entity_type][$type] as $field_name => $field) {
                if (!isset($types[$entity_type . ':' . $field_name])) {
                    $types[$entity_type . ':' . $field_name] = array(
                        'category' => t('Form'),
                        'icon' => 'icon_field.png',
                        'title' => t('Field form: @widget_label', array(
                            '@widget_label' => t($field['label']),
                        )),
                        'description' => t('Field on the referenced entity.'),
                    );
                }
                $content_types[$entity_type . ':' . $field_name]['types'][$type] = $bundle['label'];
            }
        }
    }
    if (module_exists('field_group')) {
        foreach ($entities as $entity_type => $entity) {
            foreach ($entity['bundles'] as $type => $bundle) {
                if ($group_info = field_group_info_groups($entity_type, $type, "form")) {
                    foreach ($group_info as $group_name => $group) {
                        if (!isset($types[$entity_type . ':' . $group_name])) {
                            $types[$entity_type . ':' . $group_name] = array(
                                'category' => t('Form'),
                                'icon' => 'icon_field.png',
                                'title' => t('Group form: @widget_label', array(
                                    '@widget_label' => $group->label,
                                )),
                                'description' => t('Field group on the referenced entity.'),
                            );
                        }
                        $content_types[$entity_type . ':' . $group_name]['types'][$type] = $bundle['label'];
                    }
                }
            }
        }
    }
    // Create the required context for each field related to the bundle types.
    foreach ($types as $key => $field_content_type) {
        list($entity_type, $field_name) = explode(':', $key, 2);
        $types[$key]['required context'] = new ctools_context_required(t(ucfirst($entity_type)), $entity_type, array(
            'form' => array(
                'form',
            ),
            'type' => array_keys($content_types[$key]['types']),
        ));
        unset($content_types[$key]['types']);
    }
    return $types;
}