- ๐ฌ๐งUnited Kingdom adamps
I 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.
- ๐ช๐ธSpain Aranzazu_dru
I 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!
- Status changed to Active
over 1 year ago 5:15pm 16 May 2023 - ๐ฌ๐งUnited Kingdom adamps
OK, 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.
- Status changed to Needs review
over 1 year ago 5:20pm 16 May 2023 - last update
over 1 year ago 5 pass - ๐ฌ๐งUnited Kingdom adamps
Please can someone confirm if this fixes the problem?
- ๐ฎ๐ณIndia Raveen Kumar
@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. - ๐ฌ๐งUnited Kingdom adamps
@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.
- ๐ฎ๐ณIndia Raveen Kumar
@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 body policy field.
- ๐ฌ๐งUnited Kingdom adamps
@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๐.
-
AdamPS โ
committed 39716452 on 1.x
Issue #3354578 by AdamPS, Raveen Thakur: Error creating new policy body...
-
AdamPS โ
committed 39716452 on 1.x
- Status changed to Fixed
over 1 year ago 4:59pm 14 July 2023 Automatically closed - issue fixed for 2 weeks with no activity.