Problem/Motivation

When creating a custom message for the maintenance page, you can use HTML at /admin/config/development/maintenance. The purpose of this issue is to enable the WYSIWYG editor on this page.

User interface changes

Before:
Before

Expected after:
After

Impacts

  1. Update the system.schema and the corresponding system.maintenace configuration.
  2. Add hook_update_N() for this.
  3. Update MaintenanceForm to allow WYSIWYG.
  4. Update the message display in Maintenance page to let the message value being displayed.
  5. Update tests
  6. Update translation tests
  7. Update update process (from D6/D7 to D8)
  8. Update the update process tests.

Data model changes

Before message is now a text_format instead of text in system.schema.yml, the system.maintenance.yml is impacted. message key is now an array of value / format.

Before:

message: '@site is currently under maintenance. We should be back shortly. Thank you for your patience.'
langcode: en

After:

message:
  value: '@site is currently under maintenance. We should be back shortly. Thank you for your patience.'
  format: plain_text
langcode: en
CommentFileSizeAuthor
#59 system-maintenance-message-text-format-d11.patch3.57 KBsimbaw
#57 2747749-56.patch11.22 KByuehua
#55 2747749-55.patch10.51 KB_utsavsharma
#55 interdiff_54-55.txt1.59 KB_utsavsharma
#54 2747749-wysiwyg-maintenance-page-10.1x_53.patch10.53 KBjessey
#53 interdiff-2.txt4.35 KBzeeshan_khan
#53 2747749-wysiwyg-maintenance-page-10x_52.patch10.51 KBzeeshan_khan
#52 2747749-wysiwyg-maintenance-page-10x_51.patch10.63 KBjessey
#50 2747749-wysiwyg-maintenance-page-95x_50.patch10.53 KBearthday47
#43 2747749-wysiwyg-maintenance-page-94x_42.patch10.5 KBaaronchristian
#41 2747749-wysiwyg-maintenance-page-93x_41.patch10.22 KBbbombachini
#41 2747749-wysiwyg-maintenance-page-92x_41.patch9.31 KBbbombachini
#37 interdiff_2747749_33-37.txt355 bytesankithashetty
#37 2747749-37.patch1.64 KBankithashetty
#33 interdiff_29-33.txt557 bytesswatichouhan012
#33 2747749-33.patch1.16 KBswatichouhan012
#31 2747749-29.patch1.16 KBanweshasinha
#28 wysiwyg_maintenance_message-2747749-28.patch9.91 KBbbombachini
#25 interdiff_22_25.txt539 bytesanmolgoyal74
#25 2747749-25.patch9.13 KBanmolgoyal74
#23 2747749-22.patch9.07 KBnikitagupta
wysiwyg_maintenance_message--2747749-12.patch10.77 KBhuberyl
wysiwyg_maintenance_message--2747749-11.patch10.66 KBhuberyl
#19 wysiwyg_maintenance_message--2747749-10.patch9.74 KBhuberyl
#18 wysiwyg_maintenance_message--2747749-9.patch4.1 KBWilliamp@ciandt.com
#17 wysiwyg_maintenance_message--2747749-8.patch3.6 KBWilliamp@ciandt.com
#7 wysiwyg_maintenance_message--2747749-7.patch9.99 KBdom.
#5 wysiwyg_maintenance_message--2747749-5.patch7.59 KBdom.
#2 wysiwyg_maintenance_message--2747749-2.patch7.61 KBdom.
after.PNG29.32 KBdom.
before.PNG15.73 KBdom.

Comments

Dom. created an issue. See original summary.

dom.’s picture

Status: Active » Needs review
StatusFileSize
new7.61 KB

Here is a first draft of a patch. To be honest, I expect it to fail on tests, but it will help to isolate the various impacts described in the issue description.

cilefen’s picture

Component: views.module » base system
Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 2: wysiwyg_maintenance_message--2747749-2.patch, failed testing.

dom.’s picture

Status: Needs work » Needs review
StatusFileSize
new7.59 KB

Sorry, forgot a dsm() instruction. Rerolling.

Status: Needs review » Needs work

The last submitted patch, 5: wysiwyg_maintenance_message--2747749-5.patch, failed testing.

dom.’s picture

Status: Needs work » Needs review
StatusFileSize
new9.99 KB

Status: Needs review » Needs work

The last submitted patch, 7: wysiwyg_maintenance_message--2747749-7.patch, failed testing.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Williamp@ciandt.com’s picture

Williamp@ciandt.com’s picture

StatusFileSize
new4.1 KB
huberyl’s picture

StatusFileSize
new9.74 KB
avpaderno’s picture

Status: Needs work » Needs review
avpaderno’s picture

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

nikitagupta’s picture

StatusFileSize
new9.07 KB

Reroll the patch againts #7.

avpaderno’s picture

Status: Needs review » Needs work
anmolgoyal74’s picture

Status: Needs work » Needs review
StatusFileSize
new9.13 KB
new539 bytes

Fixed syntax error in #22.

Status: Needs review » Needs work

The last submitted patch, 25: 2747749-25.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

bbombachini’s picture

I needed this patch for 8.9x so I've just rerolled the patch and I've updated schema that was missing.

bbombachini’s picture

anweshasinha’s picture

I am working on it

anweshasinha’s picture

Status: Needs work » Needs review
StatusFileSize
new1.16 KB

Hi,
Please review and test my patch.

avpaderno’s picture

Status: Needs review » Needs work
     $form['maintenance_mode_message'] = [
-      '#type' => 'textarea',
+      '#type' => 'text_format',
       '#title' => $this->t('Message to display when in maintenance mode'),
       '#default_value' => $config->get('message'),
+      '#format' => 'full_html'
     ];

The last item in an array needs a comma at the end, like the other items.

swatichouhan012’s picture

Status: Needs work » Needs review
StatusFileSize
new1.16 KB
new557 bytes

Added fixes of #32 and created new patch, please review

Status: Needs review » Needs work

The last submitted patch, 33: 2747749-33.patch, failed testing. View results

avpaderno’s picture

The tests are falling because this warning.

Your XML configuration validates against a deprecated schema.

Since the configuration has been changed, the schema for that configuration needs to be changed as well.

avpaderno’s picture

In this case, the part to change is the following one, in system.schema.yml.

system.maintenance:
  type: config_object
  label: 'Maintenance mode'
  mapping:
    message:
      type: text
      label: 'Message to display when in maintenance mode'

I didn't find documentation for the values to assign to type. I cannot say which one is correct for a value that is changed using a text_area form element.

ankithashetty’s picture

Status: Needs work » Needs review
StatusFileSize
new1.64 KB
new355 bytes

Tried fixing test errors in #33.

@apaderno, thank you for the hint. Came across this doc => https://api.drupal.org/api/drupal/core%21config%21schema%21core.data_types.schema.yml/8.2.x , which redirected me to https://git.drupalcode.org/project/drupal/blob/8.0.x/core/config/schema/core.data_types.schema.yml#L750 line. Hopefully this should fix.

Thank you!

bbombachini’s picture

Although the patch worked, the content rendered wasn't being processed by ckeditor, so entities weren't being replaced, etc.

I had to preprocess the content and run it through the text format, like:

/**
 * Implements template_preprocess_maintenance_page().
 */
function custom_theme_preprocess_maintenance_page(&$variables) {
  $body = $variables['page']['content']['#markup'];
  $variables['page']['content'] = [
    '#type' => 'processed_text',
    '#text' => $body->__toString(),
    '#format' => 'admin_html',
  ];
  $variables['#attached']['library'][] = 'fontawesome/fontawesome.svg';
}

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

bbombachini’s picture

After updating the site to 9.2.7 and using the patch from #37 I started getting an error and my changes wouldn't save anymore.
I don't know what happened between patch #28 and #31 but they are drastically different.
I'll do a reroll of #28 and apply the suggestions from @apaderno

bbombachini’s picture

StatusFileSize
new9.31 KB
new10.22 KB

Ok, original patch from #25 re-rolled for 9.2x and 9.3x
Please review.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

aaronchristian’s picture

Patch for 9.4.x

Status: Needs review » Needs work

The last submitted patch, 43: 2747749-wysiwyg-maintenance-page-94x_42.patch, failed testing. View results

thejimbirch’s picture

The patch in #41 for 9.3.x worked for me. Remember to run drush updb or hit update.php before you save your message.

Will be back soon to try the patch in #43 for 9.4.x

Thanks!

aaronchristian’s picture

Thanks Jim, yep looks like its some tests that are failing!

bbombachini’s picture

Issue tags: +Needs tests
avpaderno’s picture

Aren't the tests already implemented? The patch is changing core/modules/config/tests/src/Functional/ConfigExportUITest.php, which seem a test class for this change.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

earthday47’s picture

(not ignoring the tests question, but)
Needed to reroll the patch for Drupal 9.5.0, see attached.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

jessey’s picture

zeeshan_khan’s picture

StatusFileSize
new10.51 KB
new4.35 KB
jessey’s picture

Version: 11.x-dev » 10.1.x-dev
StatusFileSize
new10.53 KB
_utsavsharma’s picture

StatusFileSize
new1.59 KB
new10.51 KB

Fixed failures in #54.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

yuehua’s picture

StatusFileSize
new11.22 KB

Reroll the patch for Drupal 10.2.3.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

simbaw’s picture

support 11.3.5

simbaw’s picture

Version: main » 11.3.x-dev
Status: Needs work » Needs review
smustgrave’s picture

Version: 11.3.x-dev » main
Status: Needs review » Needs work

+1 for this feature!

But fixes need to be in MRs for review and have to land in main branch first and could be backported. Though as a feature probably not in 11.3

Thanks!