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.
The style reference field should allow choosing and ordering selectable styles.
Just as a content reference field does.
Comment | File | Size | Author |
---|---|---|---|
#44 | choose_and_order-2830403-44.patch | 5.63 KB | grathbone |
| |||
#43 | choose_and_order-2830403-43.patch | 5.5 KB | amarlata |
| |||
#42 | choose_and_order-2830403-42.patch | 5.67 KB | amarlata |
#28 | interdiff_20_27.txt | 1.08 KB | szato |
#28 | choose_and_order-2830403-27.patch | 6.85 KB | szato |
|
Comments
Comment #2
heddnComment #3
geek-merlin@heddn: Feel free to change back if you feel i hijack this.
Comment #4
geek-merlinRelated: #2830406: Bundleable or groupable classes
Comment #5
inversed CreditAttribution: inversed commentedHas anyone been able to setup an Entity Reference View for this?
Comment #6
geek-merlinWorkaround: use text-list and DS regions.
Also see #2867781: Add CSS classes for entity.
Comment #7
brandonratz CreditAttribution: brandonratz as a volunteer commented@inversed, I think you would need to use https://www.drupal.org/project/config_views for an Entity Reference View.
Comment #8
inversed CreditAttribution: inversed commented@brandonratz, that seemed promising as now, I can create an Entity Reference View that lists the classes, however, I still can't use that View as a filter for the Classy Paragraphs entity reference.
I wonder if I'm missing something obvious or if this usage is just unsupported.
Comment #9
brandonratz CreditAttribution: brandonratz as a volunteer commented@inversed, Promising is about as far as I got with it. I cannot get a filter to work either. The config_views may only support specific system config and would have to be extended to support this entity directly.
Comment #10
szato CreditAttribution: szato at Brainsum for Tieto commentedHi,
I created an Entity Reference Selector plugin for filtering Paragraphs classy styles with ordering functionality (by Label/Machine name). We are using in our Parade project specific machine name prefixes for "grouping" classy paragraphs styles, like 'color_', 'layout_'. So I added a ''Classy paragraphs machine name starts with" filter option too.
Comment #11
szato CreditAttribution: szato at Brainsum for Tieto commentedPach file fix.
Comment #12
jwineichen CreditAttribution: jwineichen commentedThe #11 patch is slick. Thanks for the work, @szato.
Comment #13
brockfanning CreditAttribution: brockfanning commented#11 works for me, and seems like a good way to solve the problem.
Comment #14
rteijeiro CreditAttribution: rteijeiro at Tieto commentedJust a silly question. Why using concatenation for these two strings?
The rest seems right for me. Patch applies cleanly.
Any idea about how I can properly test it?
Comment #15
szato CreditAttribution: szato at Brainsum for Tieto commentedHi rteijeiro,
thank you for the review.
Concatenation: we are using the same t() string on line #77. So the reason is re-using translated string.
Testing:
1) Download and install the dev version of classy paragraphs module.
2) Apply the patch #11.
3) Add classy paragraphs field and choose 'Classy paragraphs' reference method for 'REFERENCE TYPE' at field settings.
4) If you enjoyed, set 'Reviewed & tested by the community' for issue :)
Comment #16
szato CreditAttribution: szato at Brainsum for Tieto commentedComment #17
jsbalseraI have tested the patch and it works perfectly, thank you for your work. Additionally phpcs didn't flag any error, therefore I change the status :-)
Comment #18
grathbone CreditAttribution: grathbone at VMLY&R commentedRunning into a problem with this patch where the configuration isn't merging with the default $selection_handler_settings when selecting filter by machine_name, since the 'filter' array is already set in the configuration. May need to make it recursively merge the array.
Comment #19
VISIOS CreditAttribution: VISIOS commentedTested and works. Very helpful and great addition to the editor UX.
Comment #20
bgilhome CreditAttribution: bgilhome commentedThe patch gave me ajax errors that indexes in the handler settings weren't defined - eg. $selection_handler_settings['filter']['target_bundles']. I fixed it by adding the extra filter settings via implementing defaultConfiguration() for the plugin. Patch and interdiff attached.
Comment #21
dscl CreditAttribution: dscl at DevBrains commentedConsidering there is a new patch on #20, I'm moving the issue back to needs review.
If the patch on #20 is not the one to be merged, we can go back to #11 that was RTBC'ed.
I will try to find the time to test the #20, but hopefully somebody will do it first. :)
Comment #22
szato CreditAttribution: szato at Brainsum for Tieto commentedTested, #20 forks for me.
Comment #23
szato CreditAttribution: szato at Brainsum for Tieto commentedComment #24
BEGRAFX CreditAttribution: BEGRAFX commentedI've applied patch 11 and then patch 20, and 11 responds with, "Skipped patch 'src/Plugin/EntityReferenceSelection/ClassyParagraphsSelection.php'." and when I apply 20...
Yet when I refresh the Extend window, I find "Parade Conditional field" is inactivated, and if I attempt to activate it, I still get the message, "The Parade module requires the ClassyParagraphsSelection class. For more information, see the Choose and order selectable styles issue for Classy paragraphs style to apply patch." and the link for "patch" takes me to patch 11.
Comment #25
szato CreditAttribution: szato at Brainsum for Tieto commentedHi BEGRAFX,
1) You get an error because of you applied patch #11, you didn't remove it and tried to apply patch #20.
2) The dependency problem is parade issue, not classy paragraphs.
Comment #26
szato CreditAttribution: szato at Brainsum for Tieto commentedAdded missing entity_reference_selection.classy_paragraphs schema.
Comment #28
szato CreditAttribution: szato at Brainsum for Tieto commentedPach file fix (Add missing entity_reference_selection.classy_paragraphs schema)
Comment #29
szato CreditAttribution: szato at Brainsum for Tieto commentedComment #30
BEGRAFX CreditAttribution: BEGRAFX commented@szato,
In #25, you mention that I need to remove the previous patch before applying the newer one. I have looked through the patching information, and I don't see any information/instructions on removing a patch. Can you help me on that one?
Comment #31
szato CreditAttribution: szato at Brainsum for Tieto commented@BEGRAFX,
if you are using 'git apply', then:
git apply -R <patch>
Comment #32
BEGRAFX CreditAttribution: BEGRAFX commentedOK, I used the -R method, which apparently worked fine. There were no messages of any kind. However, when I attempted to apply patch 27 on another project:
is the result.
Comment #33
szato CreditAttribution: szato at Brainsum for Tieto commented@BEGRAFIX,
it's a local checkout of git repository?
Pls read the documentation at https://www.drupal.org/patch/apply
...and use the patch command.
Comment #34
BEGRAFX CreditAttribution: BEGRAFX commentedNo, this is on a site I have in development. I have installed the Classy Paragraphs module since it is a required module for Parade. The site is currently on my MAMP development server. I install/enable Classy Paragraphs, and it is fine. However when I then try to enable Parade, I get the message
The Parade module requires the ClassyParagraphsSelection class. For more information, see the Choose and order selectable styles issue for Classy paragraphs style to apply patch.
and when I attempt to apply the patch, I get the result mentioned in #32.
Clicking the link in the message brings me to this thread.
Comment #35
GAMe CreditAttribution: GAMe commentedDoes anyone know whats going on with this module. It doesn't seem to be getting a lot of love as the last dev and stable release were 2016. I too need this for Parade... anyone who could pick this up would be a hero in my eyes :-)
Comment #36
GAMe CreditAttribution: GAMe commentedSo I have applied patch 27 and im not getting the classy paragraphs error when enabling the modules however when I go into edit parade demo for example the dropdowns for color and layout are empty and I cant select anything. :-( Am I missing something or is this another issue?
-- Turns out I was missing something I needed to add the classy styles to the ref field as these weren't completed by default.
Thanks
Comment #37
cgmonroe CreditAttribution: cgmonroe as a volunteer commentedPatch in 28 works for me.
I'd say it's RTBC except I don't think it's the right solution to the problem of limiting classes. It can solve this, but with 20+ paragraphs, the "book work" to keep what shows up on which paragraphs is a bit much. E.g. add a new class for blog sidebar paragraph and have to edit 20 paragraph types. Not very maintainable. (Yes, you can play games with naming and inverse but on an existing site that changes a lot, this is hard to do).
IMHO, I think it might be better to redo the class entity to use bundles. Then you could create different fields that use different bundles. An example of this would be something like:
Suppose you had the following Paragraph Class Entities Definitions, listed in bundle name - entity name format.
section - bg-grey
section - bg-white
section - narrow-margins
blog - align-right
blog - align-left
blog - callout-width-33
blog - callout-width-50
Section type paragraph could have a Section Classes field that was limited to the section bundle.
Blog paragraphs could have a Blog Classes field that was limited to the blog bundle.
Need to add a new blog class? Just add a new Paragraph Class Entity of the blog bundle type and it shows up.
With this format, I think the standard select the related entity bundles field widget would work.
There is a bundled config entity type in core. Probably the biggest headache would be getting the update scripts to work properly.
Comment #38
bdevore CreditAttribution: bdevore commentedAlso wondering why this is languishing as it's a nicely defined solution that's not too complex. I've looked at Bricks/Modifiers but for my users it seems like too many options for them. As a workaround you can use Paragraphs/Field Group 3.x-Dev (You'll need the patch in this thread https://www.drupal.org/project/field_group/issues/2858336) and a text list of options to pull the tokens from.
Comment #39
mayurgajar CreditAttribution: mayurgajar as a volunteer and at QED42 for Drupal India Association commentedPatch #11 throws error : Error Fatal error: Unsupported operand types
so uploading this new patch #choose-and-order-2830403-39.patch
Comment #40
mayurgajar CreditAttribution: mayurgajar as a volunteer and at QED42 for Drupal India Association commentedPatch is failing in certain manual testing scenarios so removing the patch #choose-and-order-2830403-39.patch
DO NOT USE PATCH #39
Comment #41
amarlataWhen I applied patch #11 in Drupal 9
Notice: Undefined index: handler_settings in Drupal\classy_paragraphs\Plugin\EntityReferenceSelection\ClassyParagraphsSelection->buildConfigurationForm() (line 26 of modules/contrib/classy_paragraphs/src/Plugin/EntityReferenceSelection/ClassyParagraphsSelection.php).
Error: Unsupported operand types in Drupal\classy_paragraphs\Plugin\EntityReferenceSelection\ClassyParagraphsSelection->buildConfigurationForm() (line 30 of modules/contrib/classy_paragraphs/src/Plugin/EntityReferenceSelection/ClassyParagraphsSelection.php).
Comment #42
amarlataPatch for Drupal 9. Fix Missing handler settings after upgrade to drupal 9. handler_settings' is removed from drupal:9.0.0
https://www.drupal.org/project/paragraphs/issues/3138499
https://www.drupal.org/project/drupal/issues/3114032
Comment #43
amarlataPatch for Drupal 9. Fix Missing handler settings after upgrade to drupal 9. handler_settings' is removed from drupal:9.0.0
https://www.drupal.org/project/paragraphs/issues/3138499
https://www.drupal.org/project/drupal/issues/3114032
#42 patch is not applying.
Comment #44
grathbone CreditAttribution: grathbone at VMLY&R commentedKept running into ajax issues due to unset indexes in the config array.
Not sure if this is the correct solution or adding them to default config also.
The main issue seemed to be happening when switching between modes.
Comment #45
rroose CreditAttribution: rroose commented#43 worked for me after updating my site to Drupal 9. Thanks amarlata!
Comment #46
spfaffly CreditAttribution: spfaffly at VMLY&R commented#44 helped me solve an issue on an earlier patch. It resolved a notice error:
Thanks @grathbone!
Comment #47
szato CreditAttribution: szato at Brainsum commentedChecked with D9 core. Works, no notices.
Comment #48
i-trokhanenkoComment #50
i-trokhanenkoCommitted #44. Thanks!