backdrop-contrib / paragraphs

Paragraphs module to control your content flow
https://backdropcms.org/project/paragraphs
GNU General Public License v2.0
5 stars 11 forks source link

Feature request: Check if there is a visible Paragraphs item before displaying a Paragraphs field #100

Closed Retsell closed 3 days ago

Retsell commented 2 years ago

If the paragraph title is set to be displayed for a paragraph, the title remains displayed after the paragraph is unpublished. The title should disappear too. (Using 1.x-1.2.0-alpha1)

laryn commented 2 years ago

@Retsell Can you add a screenshot or slightly more detail? This also may depend on how we handle unpublished Paragraphs items on the front end -- @klonos suggests keeping them visible for admins but with a background that makes it clear they are unpublished (which would allow re-publishing from the front end as well).

Retsell commented 2 years ago

@klonos Here's what I tried: (I'm new to paragraphs, so maybe it's not supposed to be used like this?) I thought it would be great for making a paragraph available on my site that is dedicated to vintage motor yachts, that would contain for-sale information for those boats that are available. I would also like to turn the paragraph off once sold, but retain the information for later use if needed. Unpublishing a paragraph titled "For Sale Information" would do the trick nicely. Except that when I turn off the paragraph, it still displays the title on the page, i.e. it shows "For Sale Information" and then no for-sale information. If the paragraph is unpublished. why have the title of the paragraph still displayed?

laryn commented 2 years ago

Is "For Sale Information" the label/name of the entire Paragraphs field? (If so, is it accurate to say your request is to remove/unpublish the entire field if there are no published Paragraphs items within it?)

Showing unpublished Paragraphs items would be only for those with administrative access, not the general public.

Retsell commented 2 years ago

In the image below, on the left the For Sale Info paragraph is published. On the right I have Unpublished it, so the text and photo no longer appear, but the title still does. The paragraph is gone, shouldn't the title be hidden as well?

paragraphs

laryn commented 2 years ago

@Retsell The issue is that the field label is for the entire field, and the unpublishing option is for the individual Paragraphs items within the field (of which there may be more than one on a multivalue field).

I'll leave this open to explore at some point if it's possible to have a check to make sure a Paragraphs field has at least one visible item before displaying the field at all. In the meantime you can hide the Paragraphs field label in the content type "Manage display" screen, and show the field title in the Paragraphs type as a workaround.

Retsell commented 2 years ago

@laryn Thanks for looking into it. I hadn’t thought about the multivalue field aspect. The work around is easy enough in my case.

laryn commented 3 days ago

@Retsell This should be fixed in the next release.