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 {
foreach ($entity->getFieldDefinitions() as $field) {
if ($field->getType() === 'image') {
foreach ($entity->get($field->getName())->getValue() as $value) {
$image_data[] = [
'path' => $this->replaceBaseUrlWithCustom(
file_create_url(File::load($value['target_id'])->getFileUri())
),
'alt' => $value['alt'],
'title' => $value['title'],
] ;
if (!empty($file = File::load($value['target_id']))) {
$image_data[] = [
'path' => $this->replaceBaseUrlWithCustom(
file_create_url($file->getFileUri())
),
'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