Browse Source

Added support for image field type in web content services

Stephen Ficklin 7 years ago
parent
commit
9f4564380c
1 changed files with 10 additions and 1 deletions
  1. 10 1
      tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc

+ 10 - 1
tripal_ws/includes/TripalWebService/TripalContentService_v0_1.inc

@@ -320,7 +320,16 @@ class TripalContentService_v0_1 extends TripalWebService {
 
     $values = array();
     for ($i = 0; $i < count($items); $i++) {
-      $values[$i] = $this->sanitizeFieldKeys($this->resource, $items[$i]['value'], $bundle, $service_path);
+      if (array_key_exists('value', $items[$i])) {
+        $values[$i] = $this->sanitizeFieldKeys($this->resource, $items[$i]['value'], $bundle, $service_path);
+      }
+      elseif ($field['type'] == 'image') {
+        $url = file_create_url($items[$i]['uri']);
+        $values[$i] = $this->sanitizeFieldKeys($this->resource, $url, $bundle, $service_path);
+      }
+      else {
+        // TODO: handle this case.
+      }
     }
 
     if ($hide_fields == 'hide' and empty($values[0])) {