In Drupal 10.3.3:
I have created a markup field and entered a text in the "Markup" text field. The field is saved.
When I open the field to edit the text, only "1" is written in the field. All my text is gone.
It is the same problem with all markup fields on all my sites.
This issue has now been shown to exist across multiple version of Drupal and is not specific to 10.3.3. There is a patch attached that many report applies cleanly and fixes the issue.
Steps to Reproduce
1. Go to Structure > Content Types and click on "Manage Fields" for any content type.
2. Click the "Create new Field" button at the top right, select the "Formatted text" type on the "Add field" form. Next select "Markup" and add a Label.
3. You will now be on the field settings form. Fill out required fields and notice that the "Markup" text area contains the number "1" as shown in the attached screenshot 3473518.basic_page.field_settings.png
4. Fill out the "Markup" field with the content you want shown on the form and click save.
5. Now go to Content > Add Content > Basic Page and note that the Markup is indeed displayed as expected.
6. Now go back to the "Manage Fields" page for this content type and edit the "Markup" field. Notice that unfortunately your beautiful markup has been replaced by the number 1 again.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3473518.withoutpatchapplied.png | 450.51 KB | laceysanderson |
| #7 | 3473518.basic_page.field_settings.png | 517.08 KB | laceysanderson |
| #3 | markup-3473518-3.patch | 722 bytes | tjhellmann |
Issue fork markup-3473518
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
Comment #2
uv516 commentedI found the error myself and have solved the problem.
I hope that someone can make a patch and that the Maintainers will fix the bug in an upcoming update.
The problem uccur in file MarkupItem.php in "\modules\contrib\markup\src\Plugin\Field\FieldType\", function fieldSettingsForm, line 70:
because
isset($settings['markup']['value']) ?? '', returns (boolean) 1 if value is not empty,but
$settings['markup']['value'] ?? '',will return the field value if value is not empty.Comment #3
tjhellmannI ran into this same issue. The code change in #2 fixed the issue for us. Attaching a patch with the change.
Comment #4
uv516 commentedGreat! - I hope there will be an update very soon. There must be others besides the two of us who have the same problem?
Comment #5
alfthecat commentedComment #6
goose2000 commentedI will just report, I am on D10.3.5 and this patch applied clean and fixed the issue for me.
Thank you guys!
@uv516
@tjhellmann
Comment #7
laceysanderson commentedExpand bug report to include steps to reproduce the issue and attach screenshot.
Comment #8
laceysanderson commentedI can confirm that this issue is still relevant on the development version (commit 517b941f77) on Drupal 11.0.6 on Simplytest.me. See screenshot 3473518.withoutpatchapplied.png
Manual Testing of the patch
I then tested the patch in comment #3 on simplytest.me by setting the module version to 2.x-dev, Drupal to 11.0.6 and supplying the patch. In this environment I can confirm that the patch applies cleanly and that when following the steps to reproduce, I no longer see the error. More specifically, when editing an instance of the markup field with this patch the previously saved value of the "Markup" text area is populated. Changing this value and saving, correctly saves the new value. Viewing the "Add Basic Page" form displays the value of the markup field in the form exactly as I expected.
I also manually tested this in my own local development environment (Drupal 10.4.x-dev; PHP 8.3; PostgreSQL 16 backend; gin admin theme) and it works beautifully!
Code Review
1. The changes in the patch address the specific issue reported and only address that issue.
2. The patch applies cleanly on the most recent development version (commit 517b941f77).
3. The code change follows coding standards and is both clean and easy to read.
Based on my manual testing and code review, I believe this patch is ready! Furthermore, since other users have also reported that it applies cleanly in their environments and fixes the issue, I am marking this "Reviewed and tested by the community".
Hopefully it can be merged soon!
Comment #9
anybodyI can confirm this issue, on it! Please use MRs!
Comment #11
anybodyPlease review MR.
Comment #12
grevil commentedLGTM!
Comment #13
grevil commentedComment #14
grevil commentedNew release created: https://www.drupal.org/project/markup/releases/2.0.1