Commit 129f39b6 authored by gbyte.co's avatar gbyte.co

Issue #3078369 by jcontreras, gbyte.co: Error: Call to a member function getFileUri()

parent 221e6175
...@@ -214,13 +214,15 @@ abstract class EntityUrlGeneratorBase extends UrlGeneratorBase { ...@@ -214,13 +214,15 @@ abstract class EntityUrlGeneratorBase extends UrlGeneratorBase {
foreach ($entity->getFieldDefinitions() as $field) { foreach ($entity->getFieldDefinitions() as $field) {
if ($field->getType() === 'image') { if ($field->getType() === 'image') {
foreach ($entity->get($field->getName())->getValue() as $value) { foreach ($entity->get($field->getName())->getValue() as $value) {
$image_data[] = [ if (!empty($file = File::load($value['target_id']))) {
'path' => $this->replaceBaseUrlWithCustom( $image_data[] = [
file_create_url(File::load($value['target_id'])->getFileUri()) 'path' => $this->replaceBaseUrlWithCustom(
), file_create_url($file->getFileUri())
'alt' => $value['alt'], ),
'title' => $value['title'], 'alt' => $value['alt'],
] ; 'title' => $value['title'],
];
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment