/**
  * Injects special form fields before the form gets calculated.
  *
  * @return void
  *
  * @author Sascha Koehler <*****@*****.**>, Sebastian Diel <*****@*****.**>
  * @since 12.02.2013
  */
 public function injectSpecialFormFields()
 {
     if (array_key_exists($this->class, self::$useSpamCheck)) {
         $this->formFields['PtCaptchaInputField'] = array('type' => 'PtCaptchaInputField', 'title' => _t('CustomHtmlFormField.PtCaptchaInputField_Title'), 'form' => $this, 'checkRequirements' => array('isFilledIn' => true, 'hasLength' => CustomHtmlFormConfiguration::SpamCheck_numberOfCharsInCaptcha(), 'PtCaptchaInput' => true));
         $this->formFields['PtCaptchaImageField'] = array('type' => 'PtCaptchaImageField', 'title' => _t('CustomHtmlFormField.PtCaptchaImageField_Title'), 'form' => $this, 'maxLength' => CustomHtmlFormConfiguration::SpamCheck_numberOfCharsInCaptcha());
     }
 }
 /**
  * Returns the CustomHtmlFormConfig or triggers an error if not existent.
  *
  * @return SilvercartConfig|false
  *
  * @author Sascha Koehler <*****@*****.**>, Roland Lehmann
  * @since 10.02.2013
  */
 public static function getConfig()
 {
     if (is_null(self::$config)) {
         self::$config = SiteConfig::current_site_config();
         if (!self::$config) {
             if (SilvercartTools::isIsolatedEnvironment()) {
                 return false;
             }
             $errorMessage = _t('CustomHtmlFormConfiguration.ERROR_NO_CONFIG');
             self::triggerError($errorMessage);
         }
     }
     return self::$config;
 }
 /**
  * Initializes the field.
  *
  * @param string $name      Name of the field
  * @param string $title     Title of the field
  * @param mixed  $value     Value of the field
  * @param int    $maxLength Max input length
  * @param Form   $form      Form to relate field with
  *
  * @author Sascha Koehler <*****@*****.**>,
  *         Sebastian Diel <*****@*****.**>
  * @since 12.02.2013
  */
 public function __construct($name, $title = null, $value = null, $maxLength = null, $form = null)
 {
     parent::__construct($name, $title, $value, $maxLength, $form);
     $this->setTempDir(ASSETS_PATH . '/pt-captcha');
     $this->setWidth(CustomHtmlFormConfiguration::SpamCheck_width());
     $this->setHeight(CustomHtmlFormConfiguration::SpamCheck_height());
     $this->setJpgQuality(CustomHtmlFormConfiguration::SpamCheck_jpgQuality());
     $this->setNrOfChars(CustomHtmlFormConfiguration::SpamCheck_numberOfCharsInCaptcha());
     $this->setFont(Director::baseFolder() . '/customhtmlform/fonts/Aller_Rg.ttf');
     $this->setFormIdentifier($form->getName() . $this->getName());
 }