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

page node: form data to callback method

localhost8080

Well-known member
#1
Hello folks.

I Have a page node that is generated by my callback method.

Now I want to add some form fields and submit them to my callback class method.

Some one can help me how to pass the data to my callback class?

Thank you.
 

Lawrence

Well-known member
#2
An example from an addon I created for my site, with the actual code removed to keep it short:

The page callback that is used in the page node to point to:
PHP:
class Icewind_IcewindDale_PageCallback_TrainingHall
{
    public static function trainingHall(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract $response)
    {
        $visitor = XenForo_Visitor::getInstance()->toArray();
       // do some checks and retrieves data from the db

        $response->params['char_data'] = $characterData;

        $response->templateName = 'icewinddale_training_hall';
    }
}
Controller the form uses:

PHP:
class Icewind_IcewindDale_ControllerPublic_TrainingHall extends XenForo_ControllerPublic_Abstract
{
    public function actionHelp()
    {
        $optionsHelp = $this->_input->filterSingle('traininghall', XenForo_Input::STRING);
       // retrieve relevant data
        $viewParams = array('optionsHelp' => $charOptionsHelp);

        return $this->responseView(
            'Icewind_IcewindDale_ViewPublic_Training_Hall_Help',
             'icewinddale_training_hall_help',
             $viewParams
        );
       }
}