Commit be3043f8 authored by catch's avatar catch

Issue #2885441 by phenaproxima, acbramley, dwkitchen, jibran, hchonov,...

Issue #2885441 by phenaproxima, acbramley, dwkitchen, jibran, hchonov, larowlan: EntityReferenceAutocompleteWidget should define its size setting as an integer
parent 563c6b5a
......@@ -28,7 +28,7 @@ class EntityReferenceAutocompleteWidget extends WidgetBase {
public static function defaultSettings() {
return [
'match_operator' => 'CONTAINS',
'size' => '60',
'size' => 60,
'placeholder' => '',
] + parent::defaultSettings();
}
......
......@@ -49,14 +49,18 @@ public function testEntityReferenceAutocompleteWidget() {
// operator.
$field_name = 'field_test';
$this->createEntityReferenceField('node', 'page', $field_name, $field_name, 'node', 'default', ['target_bundles' => ['page']]);
entity_get_form_display('node', 'page', 'default')
->setComponent($field_name, [
$form_display = entity_get_form_display('node', 'page', 'default');
$form_display->setComponent($field_name, [
'type' => 'entity_reference_autocomplete',
'settings' => [
'match_operator' => 'CONTAINS',
],
])
->save();
]);
// To satisfy config schema, the size setting must be an integer, not just
// a numeric value. See https://www.drupal.org/node/2885441.
$this->assertInternalType('integer', $form_display->getComponent($field_name)['settings']['size']);
$form_display->save();
$this->assertInternalType('integer', $form_display->getComponent($field_name)['settings']['size']);
// Visit the node add page.
$this->drupalGet('node/add/page');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment