Skip to content
This repository was archived by the owner on Jan 5, 2018. It is now read-only.

Commit 749fc96

Browse files
Milos Dencevslashrsm
authored andcommitted
Fix for failing tests
1 parent 14868b7 commit 749fc96

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Form/FileEditForm.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
use Drupal\file\FileInterface;
1515
use Drupal\file_entity\Entity\FileEntity;
1616
use Drupal\file_entity\Entity\FileType;
17+
use Drupal\file_entity\UploadValidatorsTrait;
1718

1819
/**
1920
* Form controller for file type forms.
2021
*/
2122
class FileEditForm extends ContentEntityForm {
2223

24+
use UploadValidatorsTrait;
25+
2326
/**
2427
* {@inheritdoc}
2528
*/
@@ -50,7 +53,7 @@ public function form(array $form, FormStateInterface $form_state) {
5053
$form['replace_upload'] = array(
5154
'#type' => 'managed_file',
5255
'#title' => $this->t('Replace file'),
53-
'#upload_validators' => FileAddForm::getUploadValidators($replacement_options),
56+
'#upload_validators' => $this->getUploadValidators($replacement_options),
5457
);
5558

5659
$file_upload_help = array(

src/UploadValidatorsTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function getUploadValidators(array $options = array()) {
5151
$validators['file_validate_size'] = array($max_filesize);
5252

5353
// Add image validators.
54+
$options += array('min_resolution' => 0, 'max_resolution' => 0);
5455
if ($options['min_resolution'] || $options['max_resolution']) {
5556
$validators['file_validate_image_resolution'] = array(
5657
$options['max_resolution'],

0 commit comments

Comments
 (0)