1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'XenForo Development Discussions' started by Rob, Jan 20, 2015.

  1. Rob

    Rob Well-Known Member


    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?


    Last edited: Jan 20, 2015
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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:


    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.
    Rob likes this.
  3. Rob

    Rob Well-Known Member

    Ahhh... got it working.
    Now, just gotta make a cron :)
    Last edited: Jan 21, 2015

Share This Page