function ctools_entity_field_extra_content_type_content_types
Return all extra field content types available.
1 call to ctools_entity_field_extra_content_type_content_types()
- ctools_entity_field_extra_content_type_content_type in plugins/
content_types/ entity_context/ entity_field_extra.inc - Just one subtype.
File
-
plugins/
content_types/ entity_context/ entity_field_extra.inc, line 30
Code
function ctools_entity_field_extra_content_type_content_types() {
// This will hold all the individual field content types.
$types =& drupal_static(__FUNCTION__);
if (isset($types)) {
return $types;
}
$types = array();
$context_types = array();
$entities = entity_get_info();
foreach ($entities as $entity_type => $entity) {
foreach ($entity['bundles'] as $type => $bundle) {
foreach (field_info_extra_fields($entity_type, $type, 'display') as $field_name => $info) {
if (!isset($types[$entity_type . ':' . $field_name])) {
$types[$entity_type . ':' . $field_name] = array(
'category' => t(ucfirst($entity_type)),
'icon' => 'icon_field.png',
'title' => $info['label'],
'description' => isset($info['description']) ? $info['description'] : '',
);
}
$context_types[$entity_type . ':' . $field_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(
'type' => array_keys($context_types[$key]['types']),
));
unset($context_types[$key]['types']);
}
return $types;
}