backdrop-contrib / paragraphs_jquery_ui_accordion

An accordion display for paragraph title and description content on Backdrop CMS
https://backdropcms.org/project/paragraphs_jquery_ui_accordion
GNU General Public License v2.0
1 stars 4 forks source link

Allow content element to be some or all fields except title #4

Closed yorkshire-pudding closed 1 year ago

yorkshire-pudding commented 2 years ago

I wonder if it is possible for the content of a paragraph bundle to be more than one field. It would be desirable to be able to add more than one field such as text and image, text and links and possibly other content also.

Depending what is simplest, it could either be that content is multi-select so each field is positively selected to be part of content, or it could be that whatever fields are not the title would be included (unless hidden in the display).

alanmels commented 2 years ago

This module is just a Query UI Accordion plugin, so you probably wanted to file this feature request for Paragraphs module.

yorkshire-pudding commented 1 year ago

Looking back at my initial post and the reason why you closed this, I realise I was not clear enough in what I was asking. Paragraphs can already support multiple fields; the issue is if you want to put them in an accordion using this module, you can only select one field as title (which is probably fine) and one field as content, which is where the problem is. image Perhaps my accordion needs to have an image and text in each paragraph that is contained within an accordion section. While Paragraphs allows this configuration, this module only allows one field to be selected as content so you have to squeeze everything into one field. For many use cases, this may not be an issue, but for more complex uses, it falls down.

I'm not sure how straightforward it would be, but it would be good be able to add multiple fields as the content.

alanmels commented 1 year ago

I see where you are coming from and I wish there was an easy solution here. However, this module is a mere port of Drupal module, which also has the same issue according to an unanswered yet discussion on https://www.drupal.org/project/paragraphs_jquery_ui_accordion/issues/3302255 If Drupal rolls out any solution for multiple target fields then I will surely take a look to porting the same feature. Until then I'm afraid I have time to only review PRs for this issue if offered.

yorkshire-pudding commented 1 year ago

No worries. I suggest we leave it open. I had a little look at the code and I might have a go when I get a bit of time.

yorkshire-pudding commented 1 year ago

@alanmels - I've got a solution but it would be a breaking change to the current version of this module and therefore should probably either be a separate module or a major release of this module. I've not put up a pull request yet for this reason as if it should be a major release it would probably need a new branch.

Instead of selecting a field for content, it uses a paragraph display mode, whereas title is still selectable. The display mode can be customised per paragraph type, so I created an accordion display mode in one type and then in each paragraph type, I just customise to hide the title field.

It also fixes #5 (Paragraph Type with Entity Reference does not work)

I think there might be some who prefer the current simpler approach and may have built their site around this with extensive usage, so wouldn't take kindly to a breaking change and wouldn't necessarily read release notes before updating a module.

chrome_NmP03ISDcQ

chrome_cqM9GYbYay

chrome_j0qluzdQ7j

If you want to test, its at https://github.com/yorkshire-pudding/paragraphs_jquery_ui_accordion/tree/issue-4/multiple-content-fields

I'm happy to convert into a new module if that is going to be easier to manage.

alanmels commented 1 year ago

Hi Martin,

Thank you for the update. I'm ok with any of your ideas. You can create another module if you want, but planting too many modules for the same functionality is not recommended by Backdrop team. Therefore I've added you as a full admin to the module, so you are welcome to co-maintain the module.

I believe, it's ok to create a new branch something like 1.x-1.1, for the new version. I'm also ok if the new version takes the next incremental release number 1.x-1.0.3 as long as it doesn't break the existing Backdrop sites that are using this module.

I don't have time to test this for now. At best I can do it in several days.

yorkshire-pudding commented 1 year ago

Following this discussion, I've concluded that as the mechanisms for having 2 active branches in a module are not intuitive or straightforward, and this change would definitely break existing sites, it will be better to do a new module.

I think there are use cases for both modules as people may not want the overhead of having to configure display options if they are just doing a simple FAQ type use or some other case where this module works as is. For all my use cases, I've had to do quite hacky workarounds that are not great for non-technical site editors and putting this into a new module will be better.

I don't mind being a co-maintainer of this module as I'm now quite familiar with the code of this module 😉 and I know you have limited capacity for backdrop at the moment; once I've launched the other module I'll reference here and here and in the README as well as adding myself.

yorkshire-pudding commented 1 year ago

Now released in https://github.com/backdrop-contrib/paragraphs_jquery_ui_accordion2