private function TripalFieldDownloader::setRemoteFields

3.x TripalFieldDownloader.inc private TripalFieldDownloader::setRemoteFields()

A helper function for the setFields() function.

Adds remote fields to the list of fields.

1 call to TripalFieldDownloader::setRemoteFields()
TripalFieldDownloader::setFields in tripal/includes/TripalFieldDownloaders/TripalFieldDownloader.inc
Sets the fields array

File

tripal/includes/TripalFieldDownloaders/TripalFieldDownloader.inc, line 401

Class

TripalFieldDownloader

Code

private function setRemoteFields() {
  // We can't use the Tripal ws API extensions if the
  // tripal_ws module is not enabled.
  if (!module_exists('tripal_ws')) {
    return;
  }

  foreach ($this->collection_bundles as $collection_bundle) {
    $bundle_name = $collection_bundle->bundle_name;
    $site_id = $collection_bundle->site_id;
    // Skip local fields.
    if (!$site_id) {
      continue;
    }

    // Iterate through the fields of this collection and get the
    // info for each one from the class.  We will create "fake" field and
    // instance info arrays.
    foreach ($collection_bundle->fields as $field_id) {
      $field = tripal_get_remote_field_info($site_id, $bundle_name, $field_id);
      $instance = tripal_get_remote_field_instance_info($site_id, $bundle_name, $field_id);
      $this->fields[$site_id][$bundle_name][$field_id]['field'] = $field;
      $this->fields[$site_id][$bundle_name][$field_id]['instance'] = $instance;
    }
  }
}