function photos_access_photos_image_update in Album Photos 8.5
Same name and namespace in other branches
- 6.0.x photos_access/photos_access.module \photos_access_photos_image_update()
Implements hook_ENTITY_TYPE_update().
File
- photos_access/photos_access.module, line 1193 
- Implementation of photos_access.module.
Code
function photos_access_photos_image_update(EntityInterface $entity) {
  if (!\Drupal::moduleHandler()
    ->moduleExists('filefield_paths')) {
    foreach ($entity
      ->getFields() as $field) {
      if ($field instanceof FileFieldItemList) {
        /** @var \Drupal\field\Entity\FieldConfig $definition */
        $definition = $field
          ->getFieldDefinition();
        // Ignore base fields.
        if ($definition instanceof ThirdPartySettingsInterface) {
          // @todo add test to replace photos_image field image on locked
          // album and make sure it is still private.
          _photos_access_move_field_image($entity, $field);
        }
      }
    }
  }
}