function tripal_get_field_field_formatters
3.x tripal.fields.api.inc | tripal_get_field_field_formatters($field, $instance) |
Retrieves a list of field formatters compatible with a given field.
Parameters
$field: A field array as returned by the field_info_field() function.
$instance: A field instance array.
Return value
A list of file formatter class names.
4 calls to tripal_get_field_field_formatters()
- TripalContentService_v0_1::addDocBundleFieldProperties in tripal_ws/
includes/ TripalWebService/ TripalContentService_v0_1.inc - Every content type (bundle) has fields that need to be set as properties.
- TripalEntityCollection::setFormatters in tripal/
includes/ TripalEntityCollection.inc - Retrieves the list of appropriate download formatters for the basket.
- tripal_user_collections_view_page in tripal/
includes/ tripal.collections.inc - Renders a view of a data collection
- tripal_views_handler_area_collections_form in tripal/
views_handlers/ tripal_views_handler_area_collections.inc
File
- tripal/
api/ tripal.fields.api.inc, line 245 - Provides an application programming interface (API) for working with fields attached to TripalEntity content types (bundles).
Code
function tripal_get_field_field_formatters($field, $instance) {
$field_name = $field['field_name'];
$field_type = $field['type'];
$downloaders = array();
// If the field type is a TripalField then get information about the formatter.
if (tripal_load_include_field_class($field_type)) {
$formatters = $field_type::$download_formatters;
foreach ($formatters as $class_name) {
if (!array_key_exists($class_name, $downloaders)) {
tripal_load_include_downloader_class($class_name);
$downloaders[$class_name] = $class_name::$full_label;
}
}
}
else {
// For non TripalFields we'll assume TAB and CSV.
tripal_load_include_downloader_class('TripalTabDownloader');
tripal_load_include_downloader_class('TripalCSVDownloader');
$downloaders['TripalTabDownloader'] = TripalTabDownloader::$full_label;
$downloaders['TripalCSVDownloader'] = TripalCSVDownloader::$full_label;
}
return $downloaders;
}