Problem/Motivation

The text format "plain text" is visible on the text format list now.

This seems to be caused by the `processTextFormat` method of the "WebformHtmlEditor.php" file as it's not removing the fallback format from the "#allowed_formats" array when there are other available formats and causing the format to not be removed.

The code below is how Drupal core handling the fallback format.

Steps to reproduce

1. Install webform version greater than 6.2.0 beta4
2. Go to node create page.

Proposed resolution

The format should only be visible when there is no other available formats

Issue fork webform-3336477

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sker101 created an issue. See original summary.

sker101’s picture

hershey.k’s picture

hershey.k’s picture

Issue summary: View changes
jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new1.12 KB

Status: Needs review » Needs work

The last submitted patch, 5: 3336477-4.patch, failed testing. View results

jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new1.17 KB
jrockowitz’s picture

Status: Needs review » Reviewed & tested by the community

Marking this as RTBC since it must go out in the next beta release.

hershey.k’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new663.52 KB
new164.06 KB

@jrockowitz - I tested the patch on a personal project and I'm not seeing the issue resolved on my end with the patch applied.

Here's a simplytest.me spun up with Core: 9.5.3 and Webform: 2.x-dev with the patch applied and the Plain Text format is still appearing. Am I missing some step?

simplytest log
plain text

jrockowitz’s picture

Okay, I can see it on simplytest.me. I also uninstalled webform and the webform's text format did not get uninstalled.

hershey.k’s picture

Status: Needs work » Needs review
StatusFileSize
new59.68 KB

I modified the patch logic to use `array_key_exists` in-place of `isset()` for checking whether the array index exists. Because it was returning FALSE due to the key being set to `null`. See below.

With this change the patch functions as expected. MR has the modified code.

set to null

hershey.k’s picture

StatusFileSize
new64.88 KB

Here's simplytest site with updated patch applied and functioning.

functioning screenshot

jrockowitz’s picture

StatusFileSize
new2.31 KB

Thank you for reviewing the patch. Here is a lighter-weight approach to blocking the default webform text format from being exposed on other forms.

Status: Needs review » Needs work

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

hershey.k’s picture

Status: Needs work » Reviewed & tested by the community

I tested patch in #14 and it functions as expected both on a personal project and on simplytest.me.

  • jrockowitz authored c802c238 on 6.2.x
    Issue #3336477 by jrockowitz, hershy.k: Text format "plain text" is...
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.