/**
  * Save data
  *
  * @return mixed|\Thelia\Core\HttpFoundation\Response
  */
 public function saveAction()
 {
     if (null !== ($response = $this->checkAuth([AdminResources::MODULE], ["sitemap"], AccessManager::UPDATE))) {
         return $response;
     }
     $baseForm = $this->createForm("sitemap_config_form");
     $errorMessage = null;
     // Get current edition language locale
     $locale = $this->getCurrentEditionLocale();
     try {
         $form = $this->validateForm($baseForm);
         $data = $form->getData();
         // Get resize mode
         switch ($data["resize_mode"]) {
             case 'none':
                 $resizeMode = \Thelia\Action\Image::KEEP_IMAGE_RATIO;
                 break;
             case 'crop':
                 $resizeMode = \Thelia\Action\Image::EXACT_RATIO_WITH_CROP;
                 break;
             case 'borders':
             default:
                 $resizeMode = \Thelia\Action\Image::EXACT_RATIO_WITH_BORDERS;
                 break;
         }
         // Save data
         Sitemap::setConfigValue('timeout', $data['timeout']);
         Sitemap::setConfigValue('width', $data['width']);
         Sitemap::setConfigValue('height', $data['height']);
         Sitemap::setConfigValue('quality', $data['quality']);
         Sitemap::setConfigValue('rotation', $data['rotation']);
         Sitemap::setConfigValue('resize_mode', $resizeMode);
         Sitemap::setConfigValue('background_color', $data['background_color']);
         Sitemap::setConfigValue('allow_zoom', $data['allow_zoom']);
     } 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()], Sitemap::DOMAIN_NAME, $locale);
     }
     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();
 }