Skip to content

Commit

Permalink
Revert "update field_edited_text when different from the file contents (
Browse files Browse the repository at this point in the history
#769)" (#770)

This reverts commit 163a621.
  • Loading branch information
dannylamb authored Apr 7, 2020
1 parent 163a621 commit 3c969bf
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down

0 comments on commit 3c969bf

Please sign in to comment.