In a site’s front end, I build a nested menu comprising NewsPublisher-created resources.
I have a custom context menu to enable front-end node management (adding / editing) by the user.
The menu includes resources from multiple templates, with each managed via discrete NewsPublisher forms. Therefore, I create the NpEditThisButton forms manually in order to insert the correct form action URL string, as well as parameters used to set field values in the NP form itself.
The form code sent from the content menu for existing resources (i.e. “edit node”):
<form action=' formURLEdit_29 ' method='post' class='np_button_form' style='right:auto; bottom: auto;'>
<input type='hidden' name='np_existing' value='true'>
<input type='hidden' name='np_doc_id' value=' dataID '>
<input type='submit' class='np_edit_this_button' name='submit' value='Edit Category'>
</form>
where formURLEdit_29 is the URL string + parameters and dataID is relevant the resource ID.
(The HTML above uses ticks, not quotes, because I’m currently concentrating strings and variables. I’ll construct this differently eventually, just an FYI for now.)
NP forms used to edit these resources can accessed either via the context menu or the resource itself.
In the latter scenario, I use an NP form with a call that includes the &deletebutton=1
, and the button renders as expected.
This issue I seek to solve is that in the former scenario, I use a different NP form with virtually the same NP form and snippet, but in this case the &deletebutton=1
is somehow ignored.
The snippet call for the form accessed via the context menu:
[[!NewsPublisher?
&initrte=`1`
&published=`1`
&hidemenu=`0`
&deletebutton=`1`
&cssfile=`c_newspublisher.css`
&postid=`553`
&parent=`[[!getUrlParam? name=`parent`]]`
&template=`[[!getUrlParam? name=`template`]]`
&listboxmax=`1`
&show=`pagetitle,parent,menuindex,template,content`
&presets=`content:pattern-library-[[!+nowdate:default=`now`:strtotime:date=`%Y-%m-%d`]],pagetitle:[[!getUrlParam? name=`title`]],menuindex:[[!getUrlParam? name=`index`]]`
&captions=`pagetitle:Pattern Category,parent:Parent Resource: `
&outertpl=`c_npOuterTpl-patterns`
]]
And the call for the form accessed via the resource itself:
[[!NewsPublisher?
&initrte=`1`
&published=`1`
&hidemenu=`0`
&deletebutton=`1`
&cssfile=`c_newspublisher.css`
&postid=`553`
&parents=`[[+tpl_ids]]`
&templates=`26,29`
&listboxmax=`1`
&show=`pagetitle,template,parent,menuindex,content`
&presets=`content:pattern-library-[[!+nowdate:default=`now`:strtotime:date=`%Y-%m-%d`]]`
&captions=`pagetitle:Pattern Category,parent:Parent Resource: ,template:Select template: `
&outertpl=`c_npOuterTpl-patterns`
]]
(In this second form, parent IDs are generated with a getResource call.