Need to add a checkbox / toggle when editing a page node.

Rob

Well-known member
Hi,

I've got an installer that correctly adds and removes a new field to the xf_node table, its basically a boolean value, int(1).

I've managed to hook into the node edit dialogue (for pages) to add a new checkbox when editing / adding a page node but I'm now stuck as to where to go next; obviously I need the database to update and the edit form to populate correctly too.

I've tried pulling apart @Jake Bunce 's nodes as tabs add on for ideas but this handles extra options on a completely different table and uses it's own API and seems too complex for me.

I think I need to intercept the save process and somehow inject the extra field value in, but I'm totally lost here, can anyone guide me?

Thanks,

Rob
 
Last edited:
The Nodes As Tabs addon is an example you can use. That addon does make use of several components to accomplish an extended save.

The API was added in 1.2.1 in order to enable support for non-default node types. You can download version 1.2.0 which was before the API:

https://xenforo.com/community/resources/nodes-as-tabs.9/history

Then look at the ControllerAdmin classes to see the extended save. Basically you capture the input and run a query on the database. A model and datawriter is the proper way, but you can run straight queries from the controller if you want. An example can be seen in NodesAsTabs_ControllerAdmin_Forum.
 
  • Like
Reactions: Rob
Ahhh... got it working.
Now, just gotta make a cron :)
 
Last edited:
Back
Top Bottom