function tripal_get_remote_field_instance_info
3.x tripal_ws.api.inc | tripal_get_remote_field_instance_info($site_id, $bundle_accession, $field_accession) |
Behaves similar to the field_info_instance() function but for remote fields.
Returns a "fake" instance info array for fields attached to content types on remote Tripal sites.
Parameters
$site_id: The numeric site ID for the remote Tripal site.
$bundle_accession: The controlled vocabulary term accession for the content type on the remote Tripal site.
$field_accession: The controlled vocabulary term accession for the property (i.e. field) of the Class (i.e. content type).
Return value
An array similar to that returned by the field_info_instance function of Drupal for local fields.
Related topics
3 calls to tripal_get_remote_field_instance_info()
- TripalFieldDownloader::setRemoteFields in tripal/
includes/ TripalFieldDownloaders/ TripalFieldDownloader.inc - A helper function for the setFields() function.
- tripal_load_remote_entities in tripal_ws/
api/ tripal_ws.api.inc - Queries a remote site for an array of bulk entity ids.
- tripal_load_remote_entity in tripal_ws/
api/ tripal_ws.api.inc - Queries a remote site for an entity.
File
- tripal_ws/
api/ tripal_ws.api.inc, line 774 - This file provides the Tripal Web Services API: a set of functions for interacting with the Tripal Web Services.
Code
function tripal_get_remote_field_instance_info($site_id, $bundle_accession, $field_accession) {
// Get the site documentation (loads from cache if already retrieved).
$site_doc = tripal_get_remote_API_doc($site_id);
// Get the property from the document for this field.
$property = tripal_get_remote_field_doc($site_id, $bundle_accession, $field_accession);
list($vocab, $accession) = explode(':', $field_accession);
$field_name = 'tripal_remote_site_' . $site_id . '_' . $field_accession;
list($vocab, $accession) = explode(':', $field_accession);
$instance = array(
'label' => $property['hydra:title'],
'description' => $property['hydra:description'],
'formatters' => $property['tripal_formatters'],
'settings' => array(
'term_vocabulary' => $vocab,
'term_accession' => $accession
),
'field_name' => $field_name,
'entity_type' => 'TripalEntity',
'bundle_name' => $bundle_accession,
);
return $instance;
}