default textformat assumes full_html exists

Created on 6 December 2023, about 1 year ago
Updated 11 September 2024, 4 months ago

The mail's default config assumes the mail will be formatted using the text format full_html
However there is no built-in text format with that name, it comes with drupal's "standard" installation profile.
If no such text format exists, the mail body is rendered blank, so this is a bad default setting.
Suggested fix:

function mimemail_install() {
  $config = \Drupal::configFactory()->getEditable('mimemail.settings');
  if (FilterFormat::load('full_html')) {
    $config->set('format', 'full_html');
  }
  else {// enable any filter which isn't the fallback
    foreach (FilterFormat::loadMultiple() as $id => $filter_format) {
      if (!$filter_format->isFallbackFormat()) {
        break;
      }
    }
    $config->set('format', $id);
    if ($filter_format->isFallbackFormat()) {
      \Drupal::messenger()->addWarning("Mimemail couldn't find a filter with which to format mails. Please create one at admin/config/content/formats and select it at admin/system/mimemail")
  }
  $config->save();
}
πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024