Forums / Setup & design / How to change a content object Section outside edit view
Benjamin Lorteau
Monday 30 March 2009 4:14:33 pm
Hello,
I was wondering if it was possible to change the section of a content object without having to enter the edit mode, with a special form with specific action URL and particular hidden fields ?
I tried to "copy" the "Assign Section" functionnality in the edit form with something like that :
<form action="{concat('content/edit/', $node.contentobject_id,'/',$node.object.current_version)|ezurl('no')}" method="post"> <input type="hidden" name="SelectedSectionId" value="6"/> <input type="submit"name="SectionEditButton" value="Assign"/> </form>
But it doesn't actually work.
Would another approach based on section-side assignment (like in Administration -> Section page) work ? How can I skip the browse part in this case ?
Thanks in advance,Benjamin
eZ Publish personal project : http://www.aeriesguard.com [fr]
Olivier Portier
Tuesday 28 April 2009 5:04:33 am
Hi Benjamin,
May be this could help :http://ez.no/developer/contribs/hacks/section_edit
The action from your form should be section/assign/<section_id>.May be this would work better.
RegardsOlivier
Tuesday 28 April 2009 5:17:25 am
Hi Olivier and thanks for the reply.
Unfortunately, the contribution you mention in your post has already been integrated in Exponential public version. No need for a hack to change section in the admin object edit view.
My need is slightly different, I need a way to change section outside this edit view, in the admin full view, for example.
Nevertheless, I will try your guess in the form action.
Tuesday 28 April 2009 6:48:53 am
I did try with this :
<form action={'section/assign/1'|ezurl} method="post"> <input type="hidden" name="SelectedNodeIDArray[]" value="{$node.node_id}"/> <input name="BrowseActionName" value="AssignSection" type="hidden" /> <input type="submit" name="SelectButton" value="Assign"/> </form>
The redirect URL is section/list but it is working fine.
Tuesday 28 April 2009 7:11:47 am
Great, thanks a lot !
I can't try it out myself right now, but is there a hidden field for the redirection page after section assignation ?
Like RedirectAfterURL or something ?