summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries2014-06-18 20:03:01 (GMT)
committerDries2014-06-18 20:03:01 (GMT)
commite9bb4a20e4a5e2dbdbd8ea79f7a6a176836ca5ac (patch)
tree5390d608887628e01d7e217a25340b7419ede944
parentf0337421a47da85c4a450201f58b6c574600b526 (diff)
Issue #2172241 by swentel, webflo | ivanjaros: Fixed Files and image widgets completely broken.
-rw-r--r--core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php2
-rw-r--r--core/modules/image/src/Tests/ImageFieldDisplayTest.php8
2 files changed, 9 insertions, 1 deletions
diff --git a/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php b/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
index 439a183..94481c0 100644
--- a/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
+++ b/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
@@ -218,7 +218,7 @@ class ImageWidget extends FileWidget {
'#element_validate' => $element['#title_field_required'] == 1 ? array(array(get_called_class(), 'validateRequiredFields')) : array(),
);
- return $element;
+ return parent::process($element, $form_state, $form);
}
/**
diff --git a/core/modules/image/src/Tests/ImageFieldDisplayTest.php b/core/modules/image/src/Tests/ImageFieldDisplayTest.php
index c0f57fc..271e9f7 100644
--- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php
+++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php
@@ -258,6 +258,14 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
$edit['files[' . $field_name . '_1][]'] = drupal_realpath($test_image->uri);
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published'));
$this->assertText(format_string('Article @title has been updated.', array('@title' => $node->getTitle())));
+
+ // Assert ImageWidget::process() calls FieldWidget::process().
+ $this->drupalGet('node/' . $node->id() . '/edit');
+ $edit = array();
+ $edit['files[' . $field_name . '_2][]'] = drupal_realpath($test_image->uri);
+ $this->drupalPostAjaxForm(NULL, $edit, $field_name . '_2_upload_button');
+ $this->assertNoRaw('<input multiple type="file" id="edit-' . strtr($field_name, '_', '-') . '-2-upload" name="files[' . $field_name . '_2][]" size="22" class="form-file">');
+ $this->assertRaw('<input multiple type="file" id="edit-' . strtr($field_name, '_', '-') . '-3-upload" name="files[' . $field_name . '_3][]" size="22" class="form-file">');
}
/**