I have a content type where users can add any number of several types of paragraphs to build their own page. Currently the results look a bit like this:
https://www.youpickfarms.org/family-farm/wish-farms - click the FAQ tab
But I'd like to add the option for the farms to display their FAQ in an accordion similar to this as well:
https://www.stockerfarms.com/faq
Currently I'm adding a nested - accordion (paragraph of accordion content displayed as accordion) > accordion content (paragraph w/ title & description fields) as per https://www.drupal.org/project/paragraphs_jquery_ui_accordion/issues/300....
What I'd ideally like to do, though, is somehow add a simple toggle for users adding paragraphs to either show them all in an accordion or not. Is this already possible somehow or would it be somewhat trivial to allow this to be turned on in the content edit node?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | Screenshot from 2019-09-03 09-30-15.png | 17.18 KB | w01f |
| #3 | Screenshot from 2019-09-03 09-29-36.png | 25.95 KB | w01f |
| #3 | Screenshot from 2019-09-03 09-29-05.png | 99.63 KB | w01f |
| #3 | Screenshot from 2019-09-03 09-26-07.png | 101.44 KB | w01f |
Comments
Comment #2
mshdevx commentedHi @W01F,
It's a bit hard to understand what you mean.
Can you please show on screenshot how your paragraphs looks in backend and what you wan't to simplify?
Comment #3
w01f commentedHi @maxdev,
Here are a couple screenshots of my current configuration. Basically, in order to get what I wanted I had to set up:
This works by allowing the editor to create a new paragraph type that will show as an accordion, or add paragraphs that won't be. But I think a more streamlined editor experience would be to add paragraphs normally, and then simply have a toggle button to select whether they'd like the paragraphs they added to show as an accordion or not.
Comment #4
mshdevx commentedHm, seems now I understand what you meant.
Basically there are no possibility to toggle display of accordion paragraphs on fly from edit form.
In most of the cases you don't need this, because you use Accordion paragraphs only for displaying them as accordion :)
You can extend it for you specific case. For example add some checkbox field to your accordion paragraph, which will toggle the view.
Then in preprocess of field view you can set dynamically which display format to use depending on value from checkbox.