Solution: Disabling versioning for content objects
Table of contents:
Problem
The problem is versioning is built in (deep) into eZ publish. You can’t just remove it. Thankfully it is fairly configurable so you can extended the base implementation and alter key areas to archive the desired results. Which are more of a way to minimize revisions / hide the revision management.
There are a few issues involved in achieving these results.
- admin edit views
- user edit views
- add: edit view template (override) to remove / hide all non-essential functionality
- alter: (optional) a content class version history limit from 5 to 2.
- add: use hidden form fields to specify values of attributes
Misc References
- [20:20] <zrg> i think returnURI field is relevant to mention there
- [20:20] <kracker> agreed, i’m working through finding the correct acl permissions configuration for the web app
- [20:21] <zrg> also the disableconfirm, i have yet to find out tho exactly how they can be used
- [20:24] <zrg> its gonna be good. but now i sleep, will add the gory details when back among living
- [20:25] * zrg is now known as zrg_comatose
Solution #1
Restrict Class Version History (by class) to only two revisions, published or draft.
- Edit the your override for content.ini (ie: override/content.ini.append.php )
- For folder class in content.ini
- See: VersionHistoryClass[1]=5
- Change it to : VersionHistoryClass[1]=2
- Warning: If you change it to 1 (ie: VersionHistoryClass[1]=1 ) you will not be able to edit object
- How to use hidden form fields to specify values of attributes
- Remove the discard draft warning (non-core)
Solution #2
We found this kind of hack (for 3.4.2) to turn of the draft versioning mechanism: just override the content/edit_draft.tpl with this:
{let last_draft=$object.versions|extract_right(1)[0] content_attributes=$last_draft.contentobject_attributes main_node_id=$last_draft.main_parent_node_id edit_version=$last_draft.version edit_language=$last_draft.translation.language_code attribute_base='ContentObjectAttribute' } {include uri="design:content/edit.tpl"} {/let}
References
- http://ez.no/community/forum/suggestions/make_versioning_drafts_optional_per_class (last post)
- Comment, “i tried to explain how to code in my CMS to another guy once, tutored him for a week firsthand.. some time after that he started heavy drinking i heard, never seen him since :P” –#ezpublish <zrg>