Skip to content

Commit

Permalink
Coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
dannylamb committed Dec 10, 2020
1 parent a195811 commit 9ff811a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Controller/MediaSourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public function attachToMedia(
try {
$this->service->putToMedia(
$media,
$destination_field,
$destination_field,
$request->getContent(TRUE),
$content_type,
$content_location
Expand Down
5 changes: 3 additions & 2 deletions src/MediaSource/MediaSourceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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(),
]);
Expand All @@ -393,4 +393,5 @@ public function putToMedia(
throw new BadRequestHttpException("Media does not have destination field $destination_field");
}
}

}

0 comments on commit 9ff811a

Please sign in to comment.