SevenShores\Hubspot\Resources\Forms::create PHP Method

create() public method

Create a new form.
See also: http://developers.hubspot.com/docs/methods/forms/v2/create_form
public create ( array $form ) : Response
$form array
return SevenShores\Hubspot\Http\Response
    function create($form)
    {
        $endpoint = "https://api.hubapi.com/forms/v2/forms";
        $options['json'] = $form;
        return $this->client->request('post', $endpoint, $options);
    }

Usage Example

Example #1
0
 private function createForm()
 {
     $response = $this->forms->create(["name" => "Test Form " . uniqid(), "action" => "", "method" => "POST", "cssClass" => "hs-form stacked", "redirect" => "", "submitText" => "Sign Up", "followUpId" => "", "leadNurturingCampaignId" => "", "notifyRecipients" => "", "embeddedCode" => "", "formFieldGroups" => ["fields" => [["name" => "firstname", "label" => "First Name", "description" => "", "groupName" => "contactinformation", "type" => "string", "fieldType" => "text", "displayOrder" => 1, "required" => true, "enabled" => true, "hidden" => false, "defaultValue" => "", "isSmartField" => false, "validation" => ["name" => "", "message" => ""]]], "default" => true, "isSmartGroup" => false]]);
     $this->assertEquals(200, $response->getStatusCode());
     return $response;
 }