Closed (fixed)
Project:
Mailer Plus (DSM+)
Version:
1.2.1
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Apr 2023 at 09:57 UTC
Updated:
28 Jul 2023 at 16:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
adamps commentedI followed the "steps to reproduce" and it works fine for me. I guess there is something unusual about your website. The next step is for you to provide more detailed steps to reproduce.
Comment #3
aranzazu_dru commentedI think that we need more information, maybe the ajax error or something like that to see where is the problem, anyways, I had the same problem when I tried to add the body field(or others in symfony mailer) and get and ajax error.
In my case it was because trying to add the field, Drupal tries to access information that (because is a new field without information) does not exist yet...
I have solved it by modifying the code in the "BodyEmailAdjuster.php" class just like this:
public function settingsForm(array $form, FormStateInterface $form_state) {
if(!empty($this->configuration['content'])){
$content = $this->configuration['content'];
$form['content'] = [
'#title' => $this->t('Content'),
'#type' => 'text_format',
'#default_value' => $content['value'],
'#format' => $content['format'] ?? filter_default_format(),
'#required' => TRUE,
'#rows' => 10,
'#description' => $this->t('Email body. This field may support tokens or Twig template syntax – please check the supplied default policy for possible values.'),
];
}else{
$form['content'] = [
'#title' => $this->t('Content'),
'#type' => 'text_format',
'#default_value' => '',
'#format' => filter_default_format(),
'#required' => TRUE,
'#rows' => 10,
'#description' => $this->t('Email body. This field may support tokens or Twig template syntax – please check the supplied default policy for possible values.'),
];
}
...
return $form;
}
However, you must see if the problem you have is with this class or not by debuggin or something.
I hope it helps you anyways!
Comment #4
adamps commentedOK, thanks, I'm convinced - the code is accessing an undefined array key which we shouldn't do. I still can't hit the bug myself, so I guess the warning must be swallowed somehow by AJAX.
The same problem exists for WrapAndConvertEmailAdjuster. The other adjusters are fine as far as I can see.
Comment #5
adamps commentedComment #6
adamps commentedPlease can someone confirm if this fixes the problem?
Comment #7
raveen_thakur51 commented@AdamPS, I was able to add a body field. I am using Drupal version - 9.5.9, PHP - 8.1 & Composer - 2.6
I am adding a screenshot after adding the body field in add policy. Please review.
And Thank You.
Comment #8
adamps commented@Raveen, thanks. Please can you confirm (a screenshot would be great) that you saw the error without the patch? That's the key here - it needs someone who can see the original bug to confirm that it is fixed.
Comment #9
raveen_thakur51 commented@Adam, Yes sure. Am on to it. I'll let you know in a moment.
Comment #10
raveen_thakur51 commented@Adam, I wonder, could you please elaborate more on this? Because even without a patch it is working fine. It is allowing to add a new policy body field.
Comment #11
adamps commented@Raveen, yes, it's the same for me. The bug only occurs for a few people, so only those people can confirm that the patch is working. However thanks anyway for your time😃.
Comment #12
raveen_thakur51 commented@Adam, Okay. Thank You.
Comment #14
adamps commentedNo reply so I'll commit it.