private function TripalEntityCollection::setFormatters
3.x TripalEntityCollection.inc | private TripalEntityCollection::setFormatters() |
Retrieves the list of appropriate download formatters for the basket.
Return value
An associative array where the key is the TripalFieldDownloader class name and the value is the human-readable lable for the formatter.
1 call to TripalEntityCollection::setFormatters()
- TripalEntityCollection::load in tripal/
includes/ TripalEntityCollection.inc - Loads an existing collection using a collection ID.
File
- tripal/
includes/ TripalEntityCollection.inc, line 266
Class
Code
private function setFormatters() {
$downloaders = array();
// Iterate through the fields and find out what download formats are
// supported for this basket.
foreach ($this->fields as $bundle_name => $field_ids) {
// Need the site ID from the tripal_collection_bundle table.
$site_id = $this->getBundleSiteId($bundle_name);
foreach ($field_ids as $field_id) {
// If this is a field from a remote site then get it's formatters
if ($site_id and module_exists('tripal_ws')) {
$formatters = tripal_get_remote_field_formatters($site_id, $bundle_name, $field_id);
$this->formatters += $formatters;
}
else {
$field_info = field_info_field_by_id($field_id);
if (!$field_info) {
continue;
}
$field_name = $field_info['field_name'];
$instance = field_info_instance('TripalEntity', $field_name, $bundle_name);
$formatters = tripal_get_field_field_formatters($field_info, $instance);
$this->formatters += $formatters;
}
}
}
$this->formatters = array_unique($this->formatters);
return $this->formatters;
}