Customized Archetypes edit form with only one of the fields
I recently had a need for an "administration screen" for an AT-based content that would give the administrators just one field to edit and following that edit, change the workflow state of that piece of content.
Usually, to limit the fields visible in the edit form, I would give those fields different write permissions. Obviously, in this case this was not possible, so I had to take another path. Easiest way to achieve my goal was something like this:
- Make a copy of the base_edit.cpt and its .metadata file and rename them to something like "workorder_schedule_edit.cpt"
- Edit the new cpt file and change its edit body macro to something like:
<metal:body use-macro="body_macro" >
<metal:block fill-slot="widgets">
<metal:fieldMacro use-macro="python:here.widget('end_date', mode='edit')" />
</metal:block>
</metal:body>
- This would use the body defined in the edit_macros (follow the metal statements for details) and only show the 'end_date' field in the edit form.
- Next, I've changed the metadata file to insert my cpy file there
[actions]
action.success = traverse_to:string:workorder_schedule_content_edit
action.success..form_add = traverse_to:string:add_reference
action.success..cancel = traverse_to:string:go_back
action.failure = traverse_to:string:workorder_schedule_edit
From here onward things are easy. Add workorder_schedule_content_edit.cpy form controler script, and its metadata file to point back to the content_edit file.
Previous: Trying KDE as the main work desktop