NewsPublisher Edit Button

@bobray I did try this at one point a while back but was not able to get it working. I must have configured the (NpId) TV incorrectly.

The current “traditional” setup (as @donshakespeare refers to it) is a lot but it’s pretty straightforward and still manageable. Albeit not as slick or efficient as in-page editing.

Is this supposed to be working in the main release now? I was trying to do basically the same thing as the original OP placing the NpEditThis initialization inside a pdoResources template.

[[!NpEditThisButton? &debug=`1` &np_edit_id=`[[+id]]` &np_id=`[[+parent]]` &createdby=`[[+createdby]]` &ownpagesonly=`1`]]

Whenever I add &np_id=`[[+parent]]` the edit buttons disappear. The placeholder does report the parent number correctly if I place it elsewhere in the template. If I remove
&np_id=`[[+parent]]` then the edit buttons return, but it sends to another NewsPublisher instance and fails to save any updates.

The parent page does have it’s own Edit button. Not sure if that matters or what a solution is to separate them if they are conflicting.

I’m afraid I don’t have a good answer for you. That code is from four years ago. It was off the top of my head and untested. I never heard back from the OP, so I don’t know if it ever worked for anyone in any version of NP.

Can you think of anything that might prevent the button from being rendered, even if &debug=1 is set? But only when I add the &np_id=[[+parent]] call?

Does the parent tag work outside of the edit tag?

What is setting the parent placeholder (or should it be
&np_id=[[*parent]]
)?.

I’m not sure what you mean by outside the edit tag, but here is what I’m going for.

TOP PAGE (NewsPublisher #1 on page creates LEVEL 2)

-- LEVEL 2 PAGES (Template NP-Edit call in template,  anyone can edit L2 pages)
                 (Template: NewsPublisher #2 on page Creates LEVEL 3)
                 (Template: pdoPage call to summarize LEVEL 3)

-- -- LEVEL 3 PAGES (No public URL, only viewable as notes on LEVEL 2 PAGES)
                    (NP-Edit call for LEVEL 3 PAGES is inside the pdoPage template chunk)
                    (L3 "notes" are only editable by their respective creator)

There could be hundreds of LEVEL 2 PAGES and hundreds of LEVEL 3 “notes” to each LEVEL 2 PAGE. I don’t know if there is a better way to do it. I thought about using Quip, but I need multiple TVs on LEVEL 3 that pdoResources can get access to.

So it could be that pdoPage is generating the [[+parent]] placeholder.

It looks like np_id=`[[*parent]] inside the chunk returns the LEVEL 1 parent id, but the button shows up. It just won’t edit anything.

If I put in [[*id]] it returns the proper parent, but the buttons disappear again just like they did with [[+parent]].

On a slightly different note, can the Edit form that gets inserted be changed, like to change the input/submit to a button that could be more easily styled with a Font Awesome icon?

You can use a different check for the outer TPL.

What I meant by my question is what do you see if you put the [[+parent]] tag somewhere else on the page. You should see the parent page’s ID.

Are you using the &ownpagesonly property anywhere? Or is it set to true in the snippet properties?

It seems like what you’re trying to do goes well beyond what NP was designed for. It might be possible with a custom snippet that returns the proper edit button tag, but I’m not sure.