-
Notifications
You must be signed in to change notification settings - Fork 0
createFormJobHeader
#createFormJobHeader
This function will download a form and create header files so that you can easily create/modify jobs and/or submitted forms!
To create the headers, you will need to know the Form ID that you're going to use, you can either grab a list of Form IDs via
$client->Form()->getList(true)
Or you can go onto the Formitize Website, click on the drop down menu Forms then View Forms, select the form and in the URL on the top of your screen you should see /forms/edit/?id=xxx
Once you have your formID simply call the helper function
Formitize\API\Helper\Helper::createFormJobHeader($client, $formID);
This will then create headers in the folder {PATH_TO_API}/class/Job/Form/Form{formID}/
Once you have created the headers, all you have to do is simply create the class! For this example my formID will be 10355 so we previously called Formitize\API\Helper\Helper::createFormJobHeader($client, 10355);
Formitize\API\Helper\Helper::createFormJobHeader($client, 10355);
$form = new \Formitize\Job\Form\Form10355\Form();
$form->get_subheaderFieldTest()->formDate_1->setValue(date("Y-m-d", strtotime("+1 week"))) //you can chain setValue
->formLocation_1->setValue("TestLocation")
->formCheckbox_1->setValue("Test Value A", "Test Value B", "Test Value C");
The layout is very simple, once you have made your form on Formitize, the header files will reflect the layout how it is exactly, so for example if you create 2 subheaders (eg formSubheader_1, formSubheader_2) then you can access them as
$form->get_formSubheader1()->someElement->setValue("test");
$form->get_formSubheader2()->someElement2->setValue("test2");
Also please note someElement belongs to formSubheader_1 and someElement2 belongs to formSubheader_2, so they must be called from their respective subheader.
These names are automatically generated based on what object names you have made on your form elements.