Hello,
I don't know how to solve this, but I thought it could be usefull to report the bug
here is the situation :
Long text field
html default value + full html format activated
Multiple value allowed
When I create the content, the default html value is here, but if I add another item, the default value seems to be forgotten for the new item..
Regards
-p-
Comment | File | Size | Author |
---|---|---|---|
#20 | 2023-07-31_18-38.png | 16.02 KB | nlisgo |
Issue fork drupal-1285638
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 #1
catchFixing status a bit, seems like we don't have automated test coverage for that so adding tag.
Comment #2
pacome CreditAttribution: pacome commentedComment #3
pacome CreditAttribution: pacome commentedIt doesn't solve the issue, but I could get around the problem by inserting the text-field (multiple value not allowed) in a dedicated fieldcollection with multiple value allowed...
It seems to work like it should :)
++
p.
Comment #4
mkarras CreditAttribution: mkarras commentedI'm writing tests as part of Drupal Office Hours.
Comment #5
mkarras CreditAttribution: mkarras commentedVerified that this is still an issue for the case as described in the initial bug report.
When you click 'add another item' on a multiple value long text field, the default value does not flow to that item when it is created.
Comment #14
quietone CreditAttribution: quietone as a volunteer commentedTested on Drupal 9.3.x and there is something unexpected in the way default values for multivalued long text field behaves. I set the field to unlimited and set a default value in the first and third entries. Then, when adding content the default value for the first entry was correct but the default value for the third entry appeared in the second entry.
Comment #20
nlisgo CreditAttribution: nlisgo as a volunteer commentedIt is my understanding that the expected behaviour is different from what is described in the issue summary.
When you have a multi value field and you choose a default value then the first entry for the default value is for the first item and you can create subsequent default values:
The html field is broken because you cannot supply multiple values for it.
The behaviour in #14 is also expected beahviour. When you have a multi value you field then empty fields are ignored so you would find that if you returned to the interface for the default value that the second empty entry has been removed.
The bug I am experiencing is that I can not seem to set a second (or third and so on) default value for formatted text fields.
I am going to close this ticket as working as expected and open another issue to document the bug that I am experiencing which triggers the following error:
Error: Cannot use object of type Drupal\Core\StringTranslation\TranslatableMarkup as array in Drupal\text\Plugin\Field\FieldType\TextFieldItemList->defaultValuesFormValidate() (line 24 of /data/app/core/modules/text/src/Plugin/Field/FieldType/TextFieldItemList.php).
Update on the follow referenced above. I think it was an error with my setup. If I see it again and I'm confident I can surface steps to reproduce I will open an issue.