public function saveAction() { $baseForm = $this->createForm("fullcalendar.configuration"); $errorMessage = null; try { $form = $this->validateForm($baseForm); $data = $form->getData(); FullCalendar::setConfigValue(FullCalendarConfigValue::ENABLE_PREVENT_SCROLL, is_bool($data["enable_prevent_scroll"]) ? (int) $data["enable_prevent_scroll"] : $data["enable_prevent_scroll"]); } catch (FormValidationException $ex) { // Invalid data entered $errorMessage = $this->createStandardFormValidationErrorMessage($ex); } catch (\Exception $ex) { // Any other error $errorMessage = $this->getTranslator()->trans('Sorry, an error occurred: %err', ['%err' => $ex->getMessage()], [], FullCalendar::MESSAGE_DOMAIN); } if (null !== $errorMessage) { // Mark the form as with error $baseForm->setErrorMessage($errorMessage); // Send the form and the error to the parser $this->getParserContext()->addForm($baseForm)->setGeneralError($errorMessage); } else { $this->getParserContext()->set("success", true); } return $this->defaultAction(); }