Problem/Motivation
Follow-up to #2831763: Use Paragraphs types icons in the "Modal" add mode.
After the parent is committed, in ParagraphsWidget::buildModalAddForm
there will be:
$element['#attached']['drupalSettings']['paragraphs'] = [
'title' => $this->t('Add @title', ['@title' => $this->getSetting('title')]),
];
We . . . need a follow-up . . . because this ["drupalSettings"] is global and having multiple paragraphs with different labels will not work.
I think we should instead set this as a data property somewhere on the button/template that we use, then we can get it from that.
Proposed resolution
Instead of using drupalSettings
, set the window title as the value of a data-*
(e.g., data-title
) attribute of an HTML element we are generating. Then make paragraphs.modal.js
retrieve it and put in on the form.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#10 | make_the_title_of_the-2898685-10.patch | 4.01 KB | Berdir |
| |||
#5 | make_the_title_of_the-2898685-5.patch | 6.37 KB | VladimirMarko |
| |||
#5 | interdiff-2898685-4-5.txt | 4.63 KB | VladimirMarko |
#5 | make_the_title_of_the-2898685-5-test-only.patch | 4.63 KB | VladimirMarko |
Comments
Comment #2
VladimirMarko CreditAttribution: VladimirMarko commentedThis patch depends on #2831763: Use Paragraphs types icons in the "Modal" add mode. Tests are missing.
Comment #3
BerdirWas wondering if we can't just use the button label, which is exactly the same.
Comment #4
VladimirMarko CreditAttribution: VladimirMarko commentedDone. Still without tests.
Comment #5
VladimirMarko CreditAttribution: VladimirMarko at MD Systems GmbH commentedAdded a test. As I added
ParagraphsTestBaseTrait::setParagraphsWidgetSettings
, there will be a merge conflict with #2896115: Autocollapse all Paragraphs except current.Comment #7
BerdirLooks fine, but yes, this or the other issue will need to rerolled.
Comment #8
miro_dietikerI plan to first review and commit the other issue. However if it is not ready yet, i'll commit this first.
Comment #9
miro_dietikerCommitted the other issue. This needs a re-roll.
Comment #10
BerdirConflict is trivial, both patches simply added the same method. So that part is now gone.
Comment #12
miro_dietikerThen committed :-)