function photos_image_update_exif_data in Album Photos 6.0.x
Same name and namespace in other branches
- 8.5 photos.module \photos_image_update_exif_data()
Exif module integration, update exif data.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The photos_image entity.
2 calls to photos_image_update_exif_data()
- photos_photos_image_presave in ./photos.module 
- Implements hook_ENTITY_TYPE_presave().
- photos_photos_image_update in ./photos.module 
- Implements hook_ENTITY_TYPE_update().
File
- ./photos.module, line 1483 
- Implementation of photos.module.
Code
function photos_image_update_exif_data(EntityInterface $entity) {
  if (\Drupal::moduleHandler()
    ->moduleExists('exif')) {
    // EXIF module integration.
    $config = Drupal::configFactory()
      ->get('exif.settings');
    $shouldUpdateMetadata = $config
      ->get('update_metadata');
    if (!isset($shouldUpdateMetadata)) {
      $shouldUpdateMetadata = TRUE;
    }
    $inserting = !isset($entity->original);
    if ($inserting || $shouldUpdateMetadata) {
      $exifContentHandler = new ExifContent();
      $exifContentHandler
        ->entity_insert_update('photos_image', $entity);
    }
  }
}