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?

Comments

W01F created an issue. See original summary.

mshdevx’s picture

Hi @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?

w01f’s picture

Hi @maxdev,

Here are a couple screenshots of my current configuration. Basically, in order to get what I wanted I had to set up:

  • A paragraph called "Accordion" with;
    • Display set to show as jquery accordion
    • An unlimited paragraph entity reference field for another paragraph type "Accordion content"
  • A paragraph called "Accordion content" with;
    • a title and description field

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.

mshdevx’s picture

Hm, 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.