From 3c969bf14f1775ebb6c52cc71b7558703f154210 Mon Sep 17 00:00:00 2001 From: dannylamb Date: Tue, 7 Apr 2020 07:36:45 -0600 Subject: [PATCH] Revert "update field_edited_text when different from the file contents (#769)" (#770) This reverts commit 163a621bc499d32a3b72da58b16b6a38d77694b4. --- .../islandora_text_extraction.module | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/islandora_text_extraction/islandora_text_extraction.module b/modules/islandora_text_extraction/islandora_text_extraction.module index 28a44553..a9440c90 100644 --- a/modules/islandora_text_extraction/islandora_text_extraction.module +++ b/modules/islandora_text_extraction/islandora_text_extraction.module @@ -34,11 +34,11 @@ function islandora_text_extraction_media_presave(MediaInterface $media) { return; } $text = $media->get('field_edited_text')->getValue(); - $file_id = $media->get('field_media_file')->getValue()[0]['target_id']; - $file = File::load($file_id); - $data = file_get_contents($file->getFileUri()); - $data = nl2br($data); - if ($text !== $data) { + if (!$text) { + $file_id = $media->get('field_media_file')->getValue()[0]['target_id']; + $file = File::load($file_id); + $data = file_get_contents($file->getFileUri()); + $data = nl2br($data); $media->set('field_edited_text', $data); $media->field_edited_text->format = 'basic_html'; }