checkAuth(AdminResources::MODULE, 'forcephone', AccessManager::UPDATE)) { return $response; } $configurationForm = $this->createForm('forcephone_configuration'); $message = null; try { $form = $this->validateForm($configurationForm); // Get the form field values $data = $form->getData(); foreach ($data as $name => $value) { if (is_array($value)) { $value = implode(';', $value); } ForcePhone::setConfigValue($name, $value); } // Log configuration modification $this->adminLogAppend( "forcephone.configuration.message", AccessManager::UPDATE, "ForcePhone configuration updated" ); // Redirect to the success URL, if ($this->getRequest()->get('save_mode') == 'stay') { // If we have to stay on the same page, redisplay the configuration page/ $url = '/admin/module/ForcePhone'; } else { // If we have to close the page, go back to the module back-office page. $url = '/admin/modules'; } return $this->generateRedirect(URL::getInstance()->absoluteUrl($url)); } catch (FormValidationException $ex) { $message = $this->createStandardFormValidationErrorMessage($ex); } catch (\Exception $ex) { $message = $ex->getMessage(); } $this->setupFormErrorContext( $this->getTranslator()->trans("ForcePhone configuration", [], ForcePhone::DOMAIN_NAME), $message, $configurationForm, $ex ); // Before 2.2, the errored form is not stored in session if (Version::test(Thelia::THELIA_VERSION, '2.2', false, "<")) { return $this->render('module-configure', [ 'module_code' => 'ForcePhone' ]); } else { return $this->generateRedirect(URL::getInstance()->absoluteUrl('/admin/module/ForcePhone')); } } }