function _field_slideshow_get_fields in Field Slideshow 7.2
Same name and namespace in other branches
- 7 field_slideshow.module \_field_slideshow_get_fields()
2 calls to _field_slideshow_get_fields()
File
- ./
field_slideshow.module, line 1132 - Implement a slideshow formatter for fields.
Code
function _field_slideshow_get_fields($field_types, $entity_type, $field_name = '') {
$links = array();
$fields = field_info_fields();
switch ($entity_type) {
case 'media':
$bundle = 'file';
$bundle_instance = 'image';
$entity_label = t('Media field:');
break;
case 'file':
$bundle = 'file';
$bundle_instance = 'file';
$entity_label = t('File field:');
break;
case 'field_collection':
$bundle = 'field_collection_item';
$bundle_instance = $field_name;
$entity_label = t('Field Collection field:');
break;
}
foreach ($fields as $name => $field) {
if (in_array($bundle, array_keys($field['bundles'])) && in_array($bundle_instance, $field['bundles'][$bundle]) && in_array($field['type'], $field_types)) {
$infos = field_info_instance($bundle, $name, $bundle_instance);
$links[$name] = $entity_label . ' ' . $infos['label'];
}
}
return $links;
}