|
@@ 127-134 (lines=8) @@
|
| 124 |
|
$cloned_entity->{$url_field_name} = ''; |
| 125 |
|
$url = NULL; |
| 126 |
|
// If the field value contains a URI... |
| 127 |
|
if (!empty($field_value['uri'])) { |
| 128 |
|
// And we can generate a URL to the file at that URI... |
| 129 |
|
$url = file_create_url($field_value['uri']); |
| 130 |
|
if (!empty($url)) { |
| 131 |
|
// Add it to the entity using the URL field name. |
| 132 |
|
$cloned_entity->{$url_field_name} = $url; |
| 133 |
|
} |
| 134 |
|
} |
| 135 |
|
} |
| 136 |
|
else { |
| 137 |
|
// Otherwise loop over the field and generate each URL. |
|
@@ 143-150 (lines=8) @@
|
| 140 |
|
$field_value = $field_wrapper->raw(); |
| 141 |
|
$url = NULL; |
| 142 |
|
// If the field value contains a URI... |
| 143 |
|
if (!empty($field_value['uri'])) { |
| 144 |
|
// And we can generate a URL to the file at that URI... |
| 145 |
|
$url = file_create_url($field_value['uri']); |
| 146 |
|
if (!empty($url)) { |
| 147 |
|
// Add it to the entity using the URL field name. |
| 148 |
|
$cloned_entity->{$url_field_name}[$delta] = $url; |
| 149 |
|
} |
| 150 |
|
} |
| 151 |
|
// If the field value did not have a URI or the URL to the file could not |
| 152 |
|
// be determined, add an empty URL string to the entity. |
| 153 |
|
if (empty($url)) { |