/** * Instantiate an Input object for the supplied field call setAllowEmpty() * depending upon whether the field is required. * * @param Field $field * @return Input */ protected function instantiateInput(Field $field) { $input = new Input($field->getControlName()); if ($field->isRequired() && !$field->isType('boolean')) { $input->setAllowEmpty(false); } else { $input->setAllowEmpty(true); } return $input; }