- Issue created by @sleewok
- π΅πΉPortugal introfini
// Not all the products have an image set if (empty($product->field_product_images->first()->entity)) { $field_config = $product->getFieldDefinition('field_product_images'); $default_image = $field_config->getSetting('default_image'); $entityrepository = \Drupal::service('entity.repository'); $defaultImageFile = $entityrepository->loadEntityByUuid('file', $default_image['uuid']); $image_uri = $defaultImageFile->getFileUri(); } else { $image_uri = $product->field_product_images->first()->entity->getFileUri(); } $values['g:image_link'] = file_create_url($image_uri);