Follow-up to #2847053: Convert a normal paragraph into the library
Problem/Motivation
A paragraph with its potential deep nested children group is converted once into a library item. Then it is used many times.
Chances are that at some point you want to override a specific placement. You then want to unlink the reference and start with a clone of the original items. People might think about these items as templates and prepare items that are cloned many times with ease: select as reference, convert, override, done! Much easier than create everything and configure all the settings for complex items...
Separate issue: we will add a checkbox to flag the items as a template. Then placing them will always clone. And if fields are empty, templates are proposed immediately in the empty widget. UX Awesomeness!
Proposed resolution
Add an item to the dropbuttons of the library item widget to convert it back to a paragraph. Pressing it would convert the paragraph type of in the widget from a library item reference to a normal paragraph. We don't delete the library item in this process.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | convert_a_library_item-2858036-26-interdiff.txt | 3.61 KB | mbovan |
| #26 | convert_a_library_item-2858036-26.patch | 7.7 KB | mbovan |
| #24 | convert_a_library_item-2858036-24.patch | 7.71 KB | mbovan |
| #17 | convert_a_library_item-2858036-17-interdiff.txt | 9.01 KB | mbovan |
| #17 | convert_a_library_item-2858036-17.patch | 7.3 KB | mbovan |
Comments
Comment #2
thenchev commentedComment #3
thenchev commentedThe part about not deleting the library item... Are we keeping the library item with the paragraph/s inside and clone a new paragraph when converting or take them out and leave an empty library item? For me the laving empty makes sense...
Comment #4
thenchev commentedI guess we wait until #2862428: Add hook function for widget gets in.
Comment #5
thenchev commentedAdded some tests.
Comment #6
primsi commentedNeeds reroll. Also let's postpone this until the hook gets in.
Comment #7
thenchev commentedreroll
Comment #8
toncic commentedAfter committing #2862428: Add hook function for widget we can continue with this issue.
Comment #9
toncic commentedJust to run tests.
Comment #10
toncic commentedNeeds reroll and changed to use alter hook function from paragraphs.
Comment #11
berdirAs discussed, this is IMHO not major.
Comment #12
tbonomelli commentedrerolled patch
Comment #13
berdirComment #14
berdirthis also needs to be converted to the new hook that we have now to alter operations on the paragraphs widget.
this is too generic and complicated, the reusable paragraph field can only have one value and the library can also only have one value, we do not need to loop or something like that. just access $library_item->get('paragraphs')->entity
We are also not adding anything new, we just replace one.
Comment #15
miro_dietikerThis needs tests.
I guess we always replace one library paragraph with one effective paragraph entity. So we don't have any shifting of id's and weight in all the various states.
Comment #16
mbovan commentedComment #17
mbovan commentedAddressed #14, improvements and test updates.
Comment #18
mbovan commentedMost of the test fails from above are related to #2855309: Create ParagraphsTestBaseTrait..
Comment #19
mbovan commentedPostponed until #2855309: Create ParagraphsTestBaseTrait. follow-up gets committed.
Comment #20
mbovan commented#2855309: Create ParagraphsTestBaseTrait. was committed. Reopening this issue.
Comment #21
miro_dietikerUpdating summary, this is not a less frequent requirement. In contrast, see above..
Comment #22
ginovski commentedNeeds reroll
This should be tested with the experimental widget I think, so the second and third argument can be removed.
I guess this will removed due to the new third party setting (allow_library_conversion)
Also, had some exceptions in the test about the ajax path
Comment #23
miro_dietikerConnecting to template issue.
Comment #24
mbovan commentedRerolled, updates, addressed #22.
Checking CI results...
Comment #25
primsi commentedI think submit functions do not get prefixed by "_".
Single word: reusable
Apart from this two nit-picks looks ok. Also tested it manually and everything seems to work fine.
Comment #26
mbovan commentedApplied suggestions from #25.
Comment #28
primsi commentedCommitted, thanks.