From 9ff811a3b17f078e57f013a39aa48b427fa5fddf Mon Sep 17 00:00:00 2001 From: dannylamb Date: Thu, 10 Dec 2020 15:20:09 +0000 Subject: [PATCH] Coding standards --- src/Controller/MediaSourceController.php | 2 +- src/MediaSource/MediaSourceService.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Controller/MediaSourceController.php b/src/Controller/MediaSourceController.php index 9706e4505..bab43fcfc 100644 --- a/src/Controller/MediaSourceController.php +++ b/src/Controller/MediaSourceController.php @@ -249,7 +249,7 @@ public function attachToMedia( try { $this->service->putToMedia( $media, - $destination_field, + $destination_field, $request->getContent(TRUE), $content_type, $content_location diff --git a/src/MediaSource/MediaSourceService.php b/src/MediaSource/MediaSourceService.php index d9388dbde..4909124b3 100644 --- a/src/MediaSource/MediaSourceService.php +++ b/src/MediaSource/MediaSourceService.php @@ -366,7 +366,7 @@ public function putToMedia( // Validate file extension. $bundle = $media->bundle(); - $destination_field_config= $this->entityTypeManager->getStorage('field_config')->load("media.$bundle.$destination_field"); + $destination_field_config = $this->entityTypeManager->getStorage('field_config')->load("media.$bundle.$destination_field"); $valid_extensions = $destination_field_config->getSetting('file_extensions'); $errors = file_validate_extensions($file, $valid_extensions); @@ -383,7 +383,7 @@ public function putToMedia( $this->updateFile($file, $resource, $mimetype); $file->save(); - // Update the media + // Update the media. $media->{$destination_field}->setValue([ 'target_id' => $file->id(), ]); @@ -393,4 +393,5 @@ public function putToMedia( throw new BadRequestHttpException("Media does not have destination field $destination_field"); } } + }