Commit 63e7c764 authored by webchick's avatar webchick
Browse files

Issue #1953444 by amateescu, xjm: Make 'target bundles' required on the Entity...

Issue #1953444 by amateescu, xjm: Make 'target bundles' required on the Entity reference instance settings form to help increase their visibility/sanity.
parent 3a91a528
...@@ -97,7 +97,8 @@ public static function settingsForm(&$field, &$instance) { ...@@ -97,7 +97,8 @@ public static function settingsForm(&$field, &$instance) {
'#type' => 'checkboxes', '#type' => 'checkboxes',
'#title' => $target_bundles_title, '#title' => $target_bundles_title,
'#options' => $bundle_options, '#options' => $bundle_options,
'#default_value' => (!empty($instance['settings']['handler_settings']['target_bundles'])) ? $instance['settings']['handler_settings']['target_bundles'] : array_keys($bundle_options), '#default_value' => (!empty($instance['settings']['handler_settings']['target_bundles'])) ? $instance['settings']['handler_settings']['target_bundles'] : array(),
'#required' => TRUE,
'#size' => 6, '#size' => 6,
'#multiple' => TRUE, '#multiple' => TRUE,
'#element_validate' => array('_entity_reference_element_validate_filter'), '#element_validate' => array('_entity_reference_element_validate_filter'),
......
...@@ -100,7 +100,9 @@ public function testFieldAdminHandler() { ...@@ -100,7 +100,9 @@ public function testFieldAdminHandler() {
$this->drupalPostAJAX(NULL, array('instance[settings][handler_settings][sort][field]' => '_none'), 'instance[settings][handler_settings][sort][field]'); $this->drupalPostAJAX(NULL, array('instance[settings][handler_settings][sort][field]' => '_none'), 'instance[settings][handler_settings][sort][field]');
// Third step: confirm. // Third step: confirm.
$this->drupalPost(NULL, array(), t('Save settings')); $this->drupalPost(NULL, array(
'instance[settings][handler_settings][target_bundles][' . key($bundles) . ']' => key($bundles),
), t('Save settings'));
// Check that the field appears in the overview form. // Check that the field appears in the overview form.
$this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', 'Test label', t('Field was created and appears in the overview page.')); $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', 'Test label', t('Field was created and appears in the overview 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