silverstripe / silverstripe-elemental

Create pages in Silverstripe CMS using content blocks
http://dna.co.nz
BSD 3-Clause "New" or "Revised" License
110 stars 115 forks source link

Disable BetterButtons Versioned buttons #37

Closed silbinarywolf closed 8 years ago

silbinarywolf commented 8 years ago

Waiting on this PR before I can action: https://github.com/unclecheese/silverstripe-gridfield-betterbuttons/pull/135

Basically, BetterButtons automatically adds 'Save & Publish' buttons for DataObject items when you're editing from a GridField. So it'd be cool if Elemental detected this and removed the buttons.

The reason you'd want this is to control various permission-y things at the Page level. It also means filling the $Content value with search data always work as expected.

Widget:
  better_buttons_versioned_enabled: false
silbinarywolf commented 8 years ago

Hm. I was mistaken, it seems even without BetterButtons, Elemental gets the publish/unpublish buttons via 'VersionedDataObjectDetailsForm_ItemRequest' in 'silverstripe-versioneddataobjects'.

So ultimately, I'd want the page a block is attached to, to have their $Content updated if an Elemental block is changed.

silbinarywolf commented 8 years ago

So I have two solutions, which would you guys be ok with a PR for?

1) Remove publish/unpublish buttons from BaseElement so all publishing is handled through Page. 2) Add an extension to BaseElement so that when saving from a GridField context, the parent/Page has its content updated. (You wouldnt necessarily want BaseElement to trigger a change on parent/Page when saving in -every- context as you'd probably end up with a slowdown)

wilr commented 8 years ago

Hi,

We're working on a patch which moves away from the search via $Content functionality and implementing a better way in Solr so that elements could be individually published. Need that as we've now got the concept of related blocks between multiple pages. How that will work is each individual element would be added as a multivalued field in Solr.

So in terms of your patch, I would like to see a config variable (say disable_element_publish_button (which is set to false by default) that when true hides the publish and unpublish functionality.

silbinarywolf commented 8 years ago

Done.

https://github.com/dnadesign/silverstripe-elemental/pull/38