*/ class ConfigurationController extends BaseAdminController { public function configureAction() { if (null !== $response = $this->checkAuth(AdminResources::MODULE, 'invoiceref', AccessManager::UPDATE)) { return $response; } $form = new ConfigurationForm($this->getRequest()); $response = null; $error_msg = null; try { $configForm = $this->validateForm($form); ConfigQuery::write('invoiceRef', $configForm->get('invoice')->getData(), true, true); // 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/ $route = '/admin/module/InvoiceRef'; } else { // If we have to close the page, go back to the module back-office page. $route = '/admin/modules'; } $response = RedirectResponse::create(URL::getInstance()->absoluteUrl($route)); } catch (FormValidationException $e) { $error_msg = $this->createStandardFormValidationErrorMessage($e); } catch (\Exception $e) { $error_msg = $e->getMessage(); } if (null !== $error_msg) { $this->setupFormErrorContext( 'InvoiceRef Configuration', $error_msg, $form, $e ); $response = $this->render( 'module-configure', ['module_code' => 'InvoiceRef'] ); } return $response; } }