public function __construct($controller, $name, $fields, $actions, $validator = null)
 {
     $fields = $fields ?: new FieldList();
     $actions = $actions ?: new FieldList();
     $fields->merge(new FieldList(array($this->makeAccessKeyField())));
     $actions->merge(new FieldList(array(new FormAction(self::SubmitButtonName, _t(__CLASS__ . '.SubmitButtonText')))));
     $validator = new RequiredFields(self::AccessKeyFieldName);
     parent::__construct($controller, self::FormName, $fields, $actions, $validator);
 }
 /**
  * Creates form with:
  *  -   Package Selector dropdown
  *  -   Start Date field
  *  -   End Date field
  *  -   'Type' field (public/private) which indicates endpoint to book package.
  *  -   'generate' action.
  *
  * @param array $controller
  * @param array $nameOverride - use this instead of default self.FormName
  * @param $fields
  * @param $actions
  * @param null $validator
  */
 public function __construct($controller, $nameOverride, $fields, $actions, $validator = null)
 {
     /** @var SS_HTTPRequest $request */
     $request = $controller->getRequest();
     $fields = $fields ?: new FieldList();
     $actions = $actions ?: new FieldList();
     // list skus available via the API or get empty array if fails
     if ($apiResponse = CheckfrontModule::api()->listPackages()) {
         $fields->push($this->makePackageSelectorField($apiResponse, $request));
         // add private endpoint, user type and payment type fields
         $fields->merge(array($this->makeDateField(self::OrganiserStartDate, ''), $this->makeDateField(self::OrganiserEndDate, ''), $this->makeDateField(self::IndividualStartDate, ''), $this->makeDateField(self::IndividualEndDate, ''), $this->makeLinkTypeField(), $this->makePaymentTypeField()));
         $actions->merge(new FieldList(array(new FormAction(static::SubmitButtonName, $this->getFieldLabel(static::SubmitButtonName)))));
     }
     // all fields are mandatory
     $validator = new RequiredFields(array_keys($fields->toArray()));
     parent::__construct($controller, $nameOverride ?: self::FormName, $fields, $actions, $validator);
 }
 /**
  * Creates form with:
  *
  *  -   Checkfront booking form fields from call to api.fetchBookingForm
  *  -   A 'book' action
  *
  * @param Controller $controller
  * @param string $name
  * @param FieldList $fields
  * @param FieldList $actions
  * @param null $validator
  */
 public function __construct($controller, $name, $fields, $actions, $validator = null)
 {
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }