Resolve #3422872 "Contact settings"
Closes #3422872
Merge request reports
Activity
added 2 commits
added 27 commits
-
a9878ee4...fa1d8ce3 - 26 commits from branch
project:11.x
- 133a6c22 - Merge remote-tracking branch 'origin/11.x' into 3422872-contact-settings
-
a9878ee4...fa1d8ce3 - 26 commits from branch
added 217 commits
-
133a6c22...a99e0b57 - 216 commits from branch
project:11.x
- eb4c0d37 - Merge remote-tracking branch 'origin/11.x' into 3422872-contact-settings
-
133a6c22...a99e0b57 - 216 commits from branch
added 1 commit
- ae328077 - Add issue link in todo for simple config violation
added 113 commits
-
ae328077...467483fe - 112 commits from branch
project:11.x
- 750147ef - Merge branch drupal:11.x into 3422872-contact-settings
-
ae328077...467483fe - 112 commits from branch
added 49 commits
-
c83ccd79...16964d02 - 48 commits from branch
project:11.x
- 081b454f - Merge branch drupal:11.x into 3422872-contact-settings
-
c83ccd79...16964d02 - 48 commits from branch
added 1 commit
- 9151cc0a - try to fix ContactSitewideTest and ContactStorageTest
269 269 public function loadMultiple(array $ids = NULL) { 270 270 $entities = []; 271 271 $preloaded_entities = []; 272 if ($ids) { 273 foreach ($ids as $key => $id) { 274 if ($id === NULL) { 275 unset($ids[$key]); 276 } 277 } 278 } - Comment on lines +272 to +278
This was introduced in the currently last commit (!6713 (9151cc0a)). This very much looks like babysitting broken code. The commit message does not justify this change, nor does this code.If those tests were failing, that very strongly suggests those tests are broken, because they must contain something like `loadMultiple(['foo', NULL, 'bar']), which makes no sense
Actually the tests are testing
// Test contact form with no default form selected. $this->config('contact.settings') ->set('default_form', '') ->save(); $this->drupalGet('contact'); $this->assertSession()->statusCodeEquals(404);
and I changed
$this->config('contact.settings') ->set('default_form', '')
to
$this->config('contact.settings') ->set('default_form', NULL)
in this test as we now can't set it to empty string.
Edited by Kunal Sachdev@wimleers If it doesn't make sense to to test if for NULL then I should remove the code to test the contact form with no default form selected, right?
Edited by Kunal SachdevThe problem is not that
contact.setting:default_form
can now be NULL. The problem is that whichever code is using that is blindly using that and assuming there's always a valid ID in there — that was never the case! It's just that switching from''
toNULL
causes a failure.IOW: the same problem existed, the symptom is just different.
Hence this MR should update (fix, really!)
\Drupal\contact\Controller\ContactController::contactSitePage()
to not do this anymore:$contact_form = $this->entityTypeManager() ->getStorage('contact_form') ->load($config->get('default_form')); // If there are no forms, do not display the form. if (empty($contact_form)) {
I have changed it already in !6713 (c83ccd79) to
$contact_form = $this->entityTypeManager() ->getStorage('contact_form') ->load($config->get('default_form')); // If there are no forms, do not display the form. if (is_null($contact_form)) {
changed this line in version 25 of the diff
- Resolved by Wim Leers
- Resolved by Wim Leers
- Resolved by Wim Leers
- Resolved by Wim Leers
- Resolved by Wim Leers
added 20 commits
-
3f04bf51...5f6c6ec6 - 19 commits from branch
project:11.x
- cec7a6bd - Merge branch drupal:11.x into 3422872-contact-settings
-
3f04bf51...5f6c6ec6 - 19 commits from branch