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

Unpublish button appears regardless of "Allow unpublishing from the admin interface." setting #123

Closed e0Re0R closed 2 years ago

e0Re0R commented 2 years ago

Hi, I presume the intended behaviour of unticking "Allow unpublishing from the admin interface." is so that the Unpublish/Publish option does not appear when editing a paragraph.

I find that the setting is being ignored. Sorry I don't know enough to provide a diff file. I'm looking at version 1.x-1.2.0-alpha2, in the paragraphs.field_widget.inc file, in the paragraphs_field_widget_form_build function At line 602 you have if (isset($bundle_info->allow_unpublish)) {

which is true even if $bundle_info->allow_unpublish == 0

I changed it to if (isset($bundle_info->allow_unpublish) && $bundle_info->allow_unpublish) {

and it has worked for me.

Hope this helps. Noel

laryn commented 2 years ago

Thanks @e0Re0R -- good catch. If the setting was turned on and then turned off it remains set and could never be hidden with the previous logic. I've changed isset to !empty which does the equivalent of what you are proposing.

I appreciate the report. This will be in the next release.