Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Library currently allows to work around paragraph limitations.
We probably need to add validation to prevent that.
Comment | File | Size | Author |
---|---|---|---|
#20 | validate_library-2882390-20.patch | 7.84 KB | Primsi |
#20 | interdiff-validate_library-2882390-20.patch.txt | 2.02 KB | Primsi |
#18 | validate_library-2882390-18.patch | 7.58 KB | mbovan |
#17 | validate_library-2882390-17.patch | 7.54 KB | Primsi |
| |||
#17 | interdiff-validate_library-2882390-17.patch.txt | 1.57 KB | Primsi |
Comments
Comment #2
miro_dietikerI guess you mean that the "add to library" action is not displayed?
A validation is a bit late.
I proposed that we should have a checkbox if a paragraph type is allowed to be put into the library.
Are we now only looking at selection plugin settings?
Comment #3
Berdirno, I'm not talking about add to library.
I'm talking about adding a library paragraph and then selecting one through auto-complete (or entity browser, or ..).
Not sure if there's an easy way to already limit it in the autocomplete/selection plugin, that's why I said validation.
maybe we have access to the field then it might be possible. needs to be investigated.
Comment #4
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedComment #5
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedAs per discussion, we will define a third party setting per paragraph type, that states, that this paragraph type can be converted into a library item. We will then check for that while displaying the button and possible creating the library entity.
Comment #6
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedThis relies on #2884095: Add paragraphs entity to hook_paragraph_widget_dropbutton_alter. Also a bit of scope creep with the use statements.
Comment #7
miro_dietikerCommitted the other. Now let's see.
Comment #9
miro_dietiker:-) Schema errors for paragraphs.paragraphs_type.text with the following errors: paragraphs.paragraphs_type.text:third_party_settings.paragraphs_library.disallow_library_conversion missing schema
Comment #10
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedLet's try again.
Comment #11
Berdirthis means it is an opt-out and not an opt-in, not sure what makes more sense.
I think we have getParagraphType() on $paragraph for this, problem is just that ParagraphsInterface is missing most of the methods it should have.
Other than that, this looks pretty good. Only problem is that this is not what I created this issue for, it was the other side of this problem, the part where you can select whatever kind of library item you want and store it, even though the target paragraph type wouldn't be allowed in this context. We either need a new issue for what the issue was about or a new issue for what the patch is about :)
Comment #12
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedI first did it the other way around, but then it felt to me that this way to be more natural. I thought that if one installs paragraphs_library, having the ability to convert paragraphs to library without additional steps is what I would expect. Both approaches are valid though.
:) Then given that we already derailed this issue my vote goes for a to rename this issue and add another one.
Comment #14
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedDid not rebase.
Comment #15
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedFollow up: #2884387: Do in fact validate library paragraphs
Comment #16
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedAs per discussion, require per type allow conversion.
Comment #17
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedFixed schema type.
Comment #18
mbovan CreditAttribution: mbovan at MD Systems GmbH commentedRerolled.
Comment #19
miro_dietikerDon't show this checkbox on from_library type.
Comment #20
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedThis applies now only for type "from_library". Not sure if there is a better way to do it.
Comment #21
miro_dietikerI think the label should more mention the library to be valuable. But at least in a test module i have seen this label skipped on this level.
Other than that i think we should get this in.
Comment #23
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedCorrected the label and committed.