XF 2.1 Custom page node with callback(s)

I'm creating a page node that contains a form. I'm quite new to the XenForo syntax, I've made custom pages which display information but never anything like this.

The section in my page template that I'm struggling with is this:

HTML:
<xf:if is="$xf.visitor.is_moderator">
    <xf:form action="{{ link('park-status') }}" class="block" ajax="true">
        <div class="block-container">
            <div class="block-body">
                <xf:editorrow name="status" value="" label="Status" />
            </div>
            <xf:submitrow submit="Submit" />
        </div>
    </xf:form>
</xf:if>

I want to use a callback to set a value for my editor row, however I also want to insert the new data from the editor row into a database with another callback. I've been trying to do this for over an hour now and I would appreciate any help.
 

Mike

XenForo developer
Staff member
Given that you're wanting to update data and things like that, you're roughly into the area of a fully fledged add-on, as you're talking about adding a route, controller, and possibly an entity. I'd recommend checking out our dev docs and following the let's build an add-on walk through:

 
Would there be any way to do this without creating an add-on? I don't need to create an entity, I just need to use the route and controller, but can't figure this out.
 

Lukas W.

Well-known member
It's not a question of needing, it's a question if wanting. Sure you can insert the data directly via SQL query for example, but you'll lose built in SQL injection protection for example and will have to do it on your own. The entity system is not an obligation to use, it's a comfortable convenience. I'd recommend sticking to the given structures, as they are there for reasons, not just to add confusing bloat, but it's your call at the end of the day.

Creating route and controller is explained in the link that Mike posted above, fwiw.
 
Top