Extend Form Controller?

Permalink
Hello everyone,,
OK so i need help on how to properly extend the Form Block, if possible.

I'm creating a custom block that is essentially the Form Block with one main difference, it will need to submit its data to an external URL. (Concrete doesn't use webHooks so if someone could point in the right direction here that would be great. :))

I want the Results/Reports page show my submissions just like the regular Form, so the External Form Block wont work here.

We can skip the edit.php & add.php files since the form will be made form in the view.php ready to display.

My block is here to simply process form submissions from a specific form and send the data to another URL while still being available to view in Concrete.

My thinking was that i could extend for the Form Blocks controller in my Custom Blocks controller, thus having access to all of the parent classes methods and only needed to write a submission processing function.
Am i correct and if not what is the proper way to go about getting the results i want?

 
rge replied on at Permalink Reply
You can extend the controller of the form block. To do this you have to create a controller.php in the application/blocks/form directory.

In the controller you have to extend the form controller that is located in the Concrete core.
<?php
namespace Application\Block\Form;
use Concrete\Block\Form\Controller as FormController;
class Controller extends FormController
{
}

In here I would overwrite the action_submit_form and call the parent after my custom code is executed.
public function action_submit_form($bID = false)
{
   // custom code
   parent::action_submit_form($bID);
}

Unfortunately the check of the required fields and redirection is done in this method. Because of this you have to execute your own code first and write your own checks.

This example uses the form block the same is possible for the express form block.