]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/helper/html/forms/class_HtmlFormHelper.php
Continued:
[core.git] / framework / main / classes / helper / html / forms / class_HtmlFormHelper.php
index 4e6fbc47eda7f2406279028dc0d263f85b4cb52b..add8e9fccbb3d83f532dc41f36a6d4ad5bc66cf6 100644 (file)
@@ -1,21 +1,25 @@
 <?php
 // Own namespace
-namespace CoreFramework\Helper;
+namespace Org\Mxchange\CoreFramework\Helper;
 
 // Import framework stuff
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Generic\EmptyVariableException;
-use CoreFramework\Generic\NullPointerException;
-use CoreFramework\Registry\Registry;
-use CoreFramework\Template\CompileableTemplate;
-use CoreFramework\Wrapper\Database\User\UserDatabaseWrapper;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Database\Frontend\User\UserDatabaseFrontend;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Helper\Template\HelpableTemplate;
+use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+
+// Import SPL stuff
+use \InvalidArgumentException;
 
 /**
  * A helper for constructing web forms
  *
  * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.shipsimu.org
  *
@@ -34,20 +38,25 @@ use CoreFramework\Wrapper\Database\User\UserDatabaseWrapper;
  */
 class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
        /**
-        * Whether the form tag is opened (keep at FALSE or else your forms will
+        * Whether the form tag is opened (keep at false or else your forms will
         * never work!)
         */
-       private $formOpened = FALSE;
+       private $formOpened = false;
 
        /**
-        * Name of the form
+        * Name of current form
         */
        private $formName = '';
 
        /**
-        * Whether form tag is enabled (default: TRUE)
+        * Id of current form
+        */
+       private $formId = '';
+
+       /**
+        * Whether form tag is enabled (default: true)
         */
-       private $formEnabled = TRUE;
+       private $formEnabled = true;
 
        // Class Constants
        const EXCEPTION_FORM_NAME_INVALID       = 0x120;
@@ -74,7 +83,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $withForm                       Whether include the form tag
         * @return      $helperInstance         A preparedf instance of this helper
         */
-       public static final function createHtmlFormHelper (CompileableTemplate $templateInstance, $formName, $formId = FALSE, $withForm = TRUE) {
+       public static final function createHtmlFormHelper (CompileableTemplate $templateInstance, string $formName, string $formId = NULL, bool $withForm = true) {
                // Get new instance
                $helperInstance = new HtmlFormHelper();
 
@@ -82,7 +91,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
                $helperInstance->setTemplateInstance($templateInstance);
 
                // Is the form id not set?
-               if ($formId === FALSE) {
+               if (is_null($formId)) {
                        // Use form id from form name
                        $formId = $formName;
                } // END - if
@@ -90,13 +99,13 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
                // Set form name
                $helperInstance->setFormName($formName);
 
-               // A form-less field may say 'FALSE' here...
-               if ($withForm === TRUE) {
+               // A form-less field may say 'false' here...
+               if ($withForm === true) {
                        // Create the form
                        $helperInstance->addFormTag($formName, $formId);
                } else {
                        // Disable form
-                       $helperInstance->enableForm(FALSE);
+                       $helperInstance->enableForm(false);
                }
 
                // Return the prepared instance
@@ -106,43 +115,38 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
        /**
         * Add the form tag or close it an already opened form tag
         *
-        * @param       $formName       Name of the form (default: FALSE)
-        * @param       $formId         Id of the form (attribute 'id'; default: FALSE)
+        * @param       $formName       Name of the form (default: false)
+        * @param       $formId         Id of the form (attribute 'id'; default: false)
         * @return      void
-        * @throws      InvalidFormNameException        If the form name is invalid ( = FALSE)
+        * @throws      InvalidFormNameException        If the form name is invalid ( = false)
         * @todo        Add some unique PIN here to bypass problems with some browser and/or extensions
         */
-       public function addFormTag ($formName = FALSE, $formId = FALSE) {
+       public function addFormTag (string $formName = NULL, string $formId = NULL) {
                // When the form is not yet opened at least form name must be valid
-               if (($this->formOpened === FALSE) && ($formName === FALSE)) {
+               if (($this->formOpened === false) && (is_null($formName))) {
                        // Thrown an exception
                        throw new InvalidFormNameException ($this, self::EXCEPTION_FORM_NAME_INVALID);
-               } // END - if
+               }
 
                // Close the form is default
                $formContent = '</form>';
 
                // Check whether we shall open or close the form
-               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Add HTML code
-                       $formContent = sprintf("<form name=\"%s\" class=\"forms\" action=\"%s/%s\" method=\"%s\" target=\"%s\"",
+                       $formContent = sprintf("<form name=\"%s\" class=\"forms\" action=\"%s/%s\" method=\"%s\" target=\"%s\" id=\"%s_form\">",
                                $formName,
-                               $this->getConfigInstance()->getConfigEntry('base_url'),
-                               $this->getConfigInstance()->getConfigEntry('form_action'),
-                               $this->getConfigInstance()->getConfigEntry('form_method'),
-                               $this->getConfigInstance()->getConfigEntry('form_target')
-                       );
-
-                       // Add form id as well
-                       $formContent .= sprintf(" id=\"%s_form\"",
+                               FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('base_url'),
+                               FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('form_action'),
+                               FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('form_method'),
+                               FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('form_target'),
                                $formId
                        );
 
-                       // Add close bracket
-                       $formContent .= '>';
-
-                       // Open the form and remeber the form name
-                       $this->formOpened = TRUE;
+                       // Open the form and remeber the form name and id
+                       $this->formName = $formName;
+                       $this->formId = $formId;
+                       $this->formOpened = true;
 
                        // Add it to the content
                        $this->addHeaderContent($formContent);
@@ -157,7 +161,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
                        } // END - if
 
                        // Simply close it
-                       $this->formOpened = FALSE;
+                       $this->formOpened = false;
 
                        // Add it to the content
                        $this->addFooterContent($formContent);
@@ -173,15 +177,16 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      void
         * @throws      FormClosedException             If the form is not yet opened
         */
-       public function addInputTextField ($fieldName, $fieldValue = '') {
+       public function addInputTextField (string $fieldName, string $fieldValue = '') {
                // Is the form opened?
-               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Generate the content
-               $inputContent = sprintf("<input type=\"text\" class=\"textfield %s_field\" name=\"%s\" value=\"%s\" />",
+               $inputContent = sprintf('<input type="text" class="form-control" id="%s_%s_field" name="%s" value="%s" />',
+                       $this->getFormId(),
                        $fieldName,
                        $fieldName,
                        $fieldValue
@@ -197,7 +202,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $fieldName      Input field name
         * @return      void
         */
-       public function addInputTextFieldWithDefault ($fieldName) {
+       public function addInputTextFieldWithDefault (string $fieldName) {
                // Get the value from instance
                $fieldValue = $this->getValueField($fieldName);
                //* DEBUG: */ print __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
@@ -215,15 +220,16 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      void
         * @throws      FormClosedException             If the form is not yet opened
         */
-       public function addInputPasswordField ($fieldName, $fieldValue = '') {
+       public function addInputPasswordField (string $fieldName, string $fieldValue = '') {
                // Is the form opened?
-               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Generate the content
-               $inputContent = sprintf("<input type=\"password\" class=\"password %s_field\" name=\"%s\" value=\"%s\" />",
+               $inputContent = sprintf('<input type="password" class="form-control" id="%s_%s_field" name="%s" value="%s" />',
+                       $this->getFormId(),
                        $fieldName,
                        $fieldName,
                        $fieldValue
@@ -242,15 +248,15 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      void
         * @throws      FormClosedException             If the form is not yet opened
         */
-       public function addInputHiddenField ($fieldName, $fieldValue = '') {
+       public function addInputHiddenField (string $fieldName, string $fieldValue = '') {
                // Is the form opened?
-               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Generate the content
-               $inputContent = sprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />",
+               $inputContent = sprintf('<input type="hidden" name="%s" value="%s" />',
                        $fieldName,
                        $fieldValue
                );
@@ -265,7 +271,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $fieldName      Input field name
         * @return      void
         */
-       public function addInputHiddenFieldWithDefault ($fieldName) {
+       public function addInputHiddenFieldWithDefault (string $fieldName) {
                // Get the value from instance
                $fieldValue = $this->getValueField($fieldName);
                //* DEBUG: */ print __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
@@ -281,9 +287,9 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $prefix         Prefix for configuration without trailing _
         * @return      void
         */
-       public function addInputHiddenConfiguredField ($fieldName, $prefix) {
+       public function addInputHiddenConfiguredField (string $fieldName, string $prefix) {
                // Get the value from instance
-               $fieldValue = $this->getConfigInstance()->getConfigEntry("{$prefix}_{$fieldName}");
+               $fieldValue = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry("{$prefix}_{$fieldName}");
                //* DEBUG: */ print __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
 
                // Add the text field
@@ -299,20 +305,20 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      void
         * @throws      FormClosedException             If the form is not yet opened
         */
-       public function addInputCheckboxField ($fieldName, $fieldChecked = TRUE) {
+       public function addInputCheckboxField (string $fieldName, bool $fieldChecked = true) {
                // Is the form opened?
-               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Set whether the check box is checked...
-               $checked = " checked=\"checked\"";
-               if ($fieldChecked === FALSE) $checked = ' ';
+               $checked = ($fieldChecked ? ' checked="checked"' : ' ');
 
                // Generate the content
-               $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox %s_field\" value=\"1\"%s/>",
+               $inputContent = sprintf('<input type="checkbox" name="%s" class="checkbox" id="%s_%s_field" value="1"%s />',
                        $fieldName,
+                       $this->getFormId(),
                        $fieldName,
                        $checked
                );
@@ -329,16 +335,16 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      void
         * @throws      FormClosedException             If the form is not yet opened
         */
-       public function addInputResetButton ($buttonText) {
+       public function addInputResetButton (string $buttonText) {
                // Is the form opened?
-               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, 'reset'), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Generate the content
-               $inputContent = sprintf("<input type=\"reset\" class=\"reset_button\" id=\"%s_reset\" value=\"%s\" />",
-                       $this->getFormName(),
+               $inputContent = sprintf('<input type="reset" class="reset_button" id="%s_reset" value="%s" />',
+                       $this->getFormId(),
                        $buttonText
                );
 
@@ -354,17 +360,17 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      void
         * @throws      FormClosedException             If the form is not yet opened
         */
-       public function addInputSubmitButton ($buttonText) {
+       public function addInputSubmitButton (string $buttonText) {
                // Is the form opened?
-               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, 'submit'), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Generate the content
-               $inputContent = sprintf("<input type=\"submit\" class=\"submit_button\" id=\"%s_submit\" name=\"%s_button\" value=\"%s\" />",
-                       $this->getFormName(),
-                       $this->getFormName(),
+               $inputContent = sprintf('<input type="submit" class="submit_button" id="%s_submit" name="%s_submit" value="%s" />',
+                       $this->getFormId(),
+                       $this->getFormId(),
                        $buttonText
                );
 
@@ -379,35 +385,32 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $groupText      Text including HTML to show above this group
         * @return      void
         * @throws      FormClosedException             If no form has been opened before
-        * @throws      EmptyVariableException  If $groupId is not set
+        * @throws      InvalidArgumentException        If $groupId is not set
         */
-       public function addFormGroup ($groupId = '', $groupText = '') {
+       public function addFormGroup (string $groupId = '', string $groupText = '') {
                // Is a form opened?
-               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Throw exception here
                        throw new FormClosedException(array($this, $groupId), self::EXCEPTION_CLOSED_FORM);
-               } // END - if
-
-               // At least the group name should be set
-               if ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === FALSE)) {
+               } elseif ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === false)) {
                        // Throw exception here
-                       throw new EmptyVariableException(array($this, 'groupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('Parameter "groupId" is empty but group is not closed');
                } elseif (empty($groupId)) {
                        // Close the last opened
                        $groupId = $this->getPreviousGroupId();
                }
 
                // Same group to open?
-               if (($this->ifGroupOpenedPreviously() === FALSE) && ($groupId === $this->getPreviousGroupId())) {
+               if (($this->ifGroupOpenedPreviously() === false) && ($groupId === $this->getPreviousGroupId())) {
                        // Abort here silently
-                       return FALSE;
+                       return false;
                } // END - if
 
                // Initialize content with closing div by default
                $content = "    </div>\n</div><!-- Group - CLOSE //-->";
 
                // Is this group opened?
-               if ($this->ifGroupOpenedPreviously() === FALSE) {
+               if ($this->ifGroupOpenedPreviously() === false) {
                        // Begin the div/span blocks
                        $content = sprintf("<!-- Group %s - OPEN //-->
 <div class=\"group_box\" id=\"%s_group_box\">
@@ -454,35 +457,32 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $subGroupText   Text including HTML to show above this group
         * @return      void
         * @throws      FormFormClosedException         If no group has been opened before
-        * @throws      EmptyVariableException          If $subGroupId is not set
+        * @throws      InvalidArgumentException                If $subGroupId is not set
         */
-       public function addFormSubGroup ($subGroupId = '', $subGroupText = '') {
+       public function addFormSubGroup (string $subGroupId = '', string $subGroupText = '') {
                // Is a group opened?
-               if ($this->ifGroupOpenedPreviously() === FALSE) {
+               if ($this->ifGroupOpenedPreviously() === false) {
                        // Throw exception here
                        throw new FormFormClosedException(array($this, $subGroupId), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
-               } // END - if
-
-               // At least the sub group name should be set
-               if ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === FALSE)) {
+               } elseif ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === false)) {
                        // Throw exception here
-                       throw new EmptyVariableException(array($this, 'subGroupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+                       throw new InvalidArgumentException('Parameter "subGroupId" is empty but sub-group is not closed');
                } elseif (empty($subGroupId)) {
                        // Close the last opened
                        $subGroupId = $this->getPreviousSubGroupId();
                }
 
                // Same sub group to open?
-               if (($this->ifSubGroupOpenedPreviously() === FALSE) && ($subGroupId == $this->getPreviousSubGroupId())) {
+               if (($this->ifSubGroupOpenedPreviously() === false) && ($subGroupId == $this->getPreviousSubGroupId())) {
                        // Abort here silently
-                       return FALSE;
+                       return false;
                } // END - if
 
                // Initialize content with closing div by default
                $content = "    </div>\n</div><!-- Sub group- CLOSE //-->";
 
                // Is this group opened?
-               if ($this->ifSubGroupOpenedPreviously() === FALSE) {
+               if ($this->ifSubGroupOpenedPreviously() === false) {
                        // Begin the span block
                        $content = sprintf("<!-- Sub group %s - OPEN //-->
 <div class=\"subgroup_box\" id=\"%s_subgroup_box\">
@@ -514,33 +514,38 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
        }
 
        /**
-        * Add text surrounded by a span block when there is a group opened before
-        * or else by a div block.
+        * Adds text surrounded by a label tag for given form field
         *
-        * @param       $fieldName                      Field name
-        * @param       $fieldText                      Text for the field
+        * @param       $fieldName              Field name
+        * @param       $fieldText              Text for the field
+        * @param       $fieldTitle             Optional title for label tag
         * @return      void
         * @throws      FormClosedException             If the form is not yet opened
         */
-       public function addFieldText ($fieldName, $fieldText) {
+       public function addFieldLabel (string $fieldName, string $fieldText, string $fieldTitle = '') {
                // Is the form opened?
-               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
-               // Set the block type
-               $block = 'div';
-               if ($this->ifGroupOpenedPreviously()) $block = 'span';
+               // Default is no title attribute
+               $titleAttribute = '';
+
+               // Is title given?
+               if (!empty($fieldTitle)) {
+                       // Create title attribute
+                       $titleAttribute = sprintf(' title="%s" data-toggle="tooltip"', $fieldTitle);
+               } // END - if
 
                // Generate the content
-               $inputContent = sprintf("       <%s id=\"%s_text\">
-               %s
-       </%s>",
-                       $block,
+               $inputContent = sprintf('<label class="col-form-label" for="%s_%s_field"%s>
+       %s
+</label>',
+                       $this->getFormId(),
                        $fieldName,
-                       $fieldText,
-                       $block
+                       $titleAttribute,
+                       $fieldText
                );
 
                // And add it
@@ -556,9 +561,9 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      void
         * @throws      FormClosedException             If the form is not yet opened
         */
-       public function addFormNote ($noteId, $formNotes) {
+       public function addFormNote (string $noteId, string $formNotes) {
                // Is the form opened?
-               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, 'form_notes'), self::EXCEPTION_CLOSED_FORM);
                } // END - if
@@ -584,15 +589,15 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      void
         * @throws      FormClosedException             If the form is not yet opened
         */
-       public function addInputSelectField ($selectId, $firstEntry) {
+       public function addInputSelectField (string $selectId, string $firstEntry) {
                // Is the form group opened?
-               if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === false) && ($this->formEnabled === true)) {
                        // Throw an exception
                        throw new FormClosedException (array($this, 'form_notes'), self::EXCEPTION_CLOSED_FORM);
                } // END - if
 
                // Shall we close or open the sub group?
-               if (($this->ifSubGroupOpenedPreviously() === FALSE) && ($this->getPreviousSubGroupId() !== $selectId)) {
+               if (($this->ifSubGroupOpenedPreviously() === false) && ($this->getPreviousSubGroupId() !== $selectId)) {
                        // Initialize first entry (which might be non-selectable if content is provided
                        if (!empty($firstEntry)) {
                                // Add selection around it
@@ -631,9 +636,9 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @throws      HelperNoPreviousOpenedSubGroupException If no previously opened sub group was found
         * @todo        Add checking if sub option is already added
         */
-       public function addSelectSubOption ($subName, $subValue) {
+       public function addSelectSubOption (string $subName, string $subValue) {
                // Is there a sub group (shall be a selection box!)
-               if ($this->ifSubGroupOpenedPreviously() === FALSE) {
+               if ($this->ifSubGroupOpenedPreviously() === false) {
                        // Then throw an exception here
                        throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
                } // END - if
@@ -659,9 +664,9 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @throws      HelperNoPreviousOpenedSubGroupException If no previously opened sub group was found
         * @todo        Add checking if sub option is already added
         */
-       public function addSelectOption ($optionName, $optionValue) {
+       public function addSelectOption (string $optionName, string $optionValue) {
                // Is there a sub group (shall be a selection box!)
-               if ($this->ifSubGroupOpenedPreviously() === FALSE) {
+               if ($this->ifSubGroupOpenedPreviously() === false) {
                        // Then throw an exception here
                        throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
                } // END - if
@@ -688,7 +693,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
 
                try {
                        // Get last executed pre filter
-                       $extraInstance = Registry::getRegistry()->getInstance('extra');
+                       $extraInstance = GenericRegistry::getRegistry()->getInstance('extra');
                } catch (NullPointerException $e) {
                        // Instance in registry is not set (NULL)
                        // @TODO We need to log this later
@@ -713,8 +718,8 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $formEnabled    Whether form is enabled or disabled
         * @return      void
         */
-       public final function enableForm ($formEnabled = TRUE) {
-               $this->formEnabled = (bool) $formEnabled;
+       public final function enableForm (bool $formEnabled = true) {
+               $this->formEnabled = $formEnabled;
        }
 
        /**
@@ -723,8 +728,8 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @param       $formName       Name of this form
         * @return      void
         */
-       public final function setFormName ($formName) {
-               $this->formName = (string) $formName;
+       public final function setFormName (string $formName) {
+               $this->formName = $formName;
        }
 
        /**
@@ -736,13 +741,32 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
                return $this->formName;
        }
 
+       /**
+        * Setter for form id
+        *
+        * @param       $formId Id of this form
+        * @return      void
+        */
+       public final function setFormId (string $formId) {
+               $this->formId = $formId;
+       }
+
+       /**
+        * Getter for form id
+        *
+        * @return      $formId Id of this form
+        */
+       public final function getFormId () {
+               return $this->formId;
+       }
+
        /**
         * Checks whether the registration requires a valid email address
         *
         * @return      $required       Whether the email address is required
         */
        public function ifRegisterRequiresEmailVerification () {
-               $required = ($this->getConfigInstance()->getConfigEntry('register_requires_email') == 'Y');
+               $required = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('register_requires_email') == 'Y');
                return $required;
        }
 
@@ -752,7 +776,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $required       Whether profile data shall be asked
         */
        public function ifRegisterIncludesProfile () {
-               $required = ($this->getConfigInstance()->getConfigEntry('register_includes_profile') == 'Y');
+               $required = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('register_includes_profile') == 'Y');
                return $required;
        }
 
@@ -762,7 +786,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isSecured      Whether this form is secured by a CAPTCHA
         */
        public function ifFormSecuredWithCaptcha () {
-               $isSecured = ($this->getConfigInstance()->getConfigEntry($this->getFormName() . '_captcha_secured') == 'Y');
+               $isSecured = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($this->getFormName() . '_captcha_secured') == 'Y');
                return $isSecured;
        }
 
@@ -772,7 +796,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $required       Whether personal data shall be asked
         */
        public function ifRegisterIncludesPersonaData () {
-               $required = ($this->getConfigInstance()->getConfigEntry('register_personal_data') == 'Y');
+               $required = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('register_personal_data') == 'Y');
                return $required;
        }
 
@@ -782,7 +806,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $required       Whether birthday shall be asked
         */
        public function ifProfileIncludesBirthDay () {
-               $required = ($this->getConfigInstance()->getConfigEntry('profile_includes_birthday') == 'Y');
+               $required = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('profile_includes_birthday') == 'Y');
                return $required;
        }
 
@@ -792,7 +816,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isUnique
         */
        public function ifEmailMustBeUnique () {
-               $isUnique = ($this->getConfigInstance()->getConfigEntry('register_email_unique') == 'Y');
+               $isUnique = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('register_email_unique') == 'Y');
                return $isUnique;
        }
 
@@ -801,8 +825,8 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         *
         * @return      $required       Whether the specified chat protocol is enabled
         */
-       public function ifChatEnabled ($chatProtocol) {
-               $required = ($this->getConfigInstance()->getConfigEntry('chat_enabled_' . $chatProtocol) == 'Y');
+       public function ifChatEnabled (string $chatProtocol) {
+               $required = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('chat_enabled_' . $chatProtocol) == 'Y');
                return $required;
        }
 
@@ -812,7 +836,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isEnabled      Whether the login is enabled or disabled
         */
        public function ifLoginIsEnabled () {
-               $isEnabled = ($this->getConfigInstance()->getConfigEntry('login_enabled') == 'Y');
+               $isEnabled = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_enabled') == 'Y');
                return $isEnabled;
        }
 
@@ -822,7 +846,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isEnabled      Whether the login shall be done by username
         */
        public function ifLoginWithUsername () {
-               $isEnabled = ($this->getConfigInstance()->getConfigEntry('login_type') == "username");
+               $isEnabled = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_type') == "username");
                return $isEnabled;
        }
 
@@ -832,7 +856,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isEnabled      Whether the login shall be done by email
         */
        public function ifLoginWithEmail () {
-               $isEnabled = ($this->getConfigInstance()->getConfigEntry('login_type') == "email");
+               $isEnabled = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('login_type') == "email");
                return $isEnabled;
        }
 
@@ -842,7 +866,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isAllowed      Whether guest login is allowed
         */
        public function ifGuestLoginAllowed () {
-               $isAllowed = ($this->getConfigInstance()->getConfigEntry('guest_login_allowed') == 'Y');
+               $isAllowed = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('guest_login_allowed') == 'Y');
                return $isAllowed;
        }
 
@@ -852,7 +876,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $requireConfirm         Whether email change must be confirmed
         */
        public function ifEmailChangeRequireConfirmation () {
-               $requireConfirm = ($this->getConfigInstance()->getConfigEntry('email_change_confirmation') == 'Y');
+               $requireConfirm = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('email_change_confirmation') == 'Y');
                return $requireConfirm;
        }
 
@@ -863,7 +887,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @todo        Implement check if rules have been changed
         */
        public function ifRulesHaveChanged () {
-               return FALSE;
+               return false;
        }
 
        /**
@@ -872,7 +896,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $emailChange    Whether changing email address is allowed
         */
        public function ifEmailChangeAllowed () {
-               $emailChange = ($this->getConfigInstance()->getConfigEntry('email_change_allowed') == 'Y');
+               $emailChange = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('email_change_allowed') == 'Y');
                return $emailChange;
        }
 
@@ -882,7 +906,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isUnconfirmed  Whether the user account is unconfirmed
         */
        public function ifUserAccountUnconfirmed () {
-               $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->getConfigEntry('user_status_unconfirmed'));
+               $isUnconfirmed = ($this->getValueField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS) === FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_unconfirmed'));
                return $isUnconfirmed;
        }
 
@@ -892,7 +916,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isUnconfirmed  Whether the user account is locked
         */
        public function ifUserAccountLocked () {
-               $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->getConfigEntry('user_status_locked'));
+               $isUnconfirmed = ($this->getValueField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS) === FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_locked'));
                return $isUnconfirmed;
        }
 
@@ -902,7 +926,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $isUnconfirmed  Whether the user account is a guest
         */
        public function ifUserAccountGuest () {
-               $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->getConfigEntry('user_status_guest'));
+               $isUnconfirmed = ($this->getValueField(UserDatabaseFrontend::DB_COLUMN_USER_STATUS) === FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('user_status_guest'));
                return $isUnconfirmed;
        }
 
@@ -913,7 +937,7 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         * @return      $refillActive   Whether the refill page is active
         */
        public function ifRefillPageActive () {
-               $refillActive = ($this->getConfigInstance()->getConfigEntry('refill_page_active') == 'Y');
+               $refillActive = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('refill_page_active') == 'Y');
                return $refillActive;
        }
 
@@ -926,10 +950,10 @@ class HtmlFormHelper extends BaseHtmlHelper implements HelpableTemplate {
         */
        public function flushContent () {
                // Is the form still open?
-               if (($this->formOpened === TRUE) && ($this->formEnabled === TRUE)) {
+               if (($this->formOpened === true) && ($this->formEnabled === true)) {
                        // Close the form automatically
                        $this->addFormTag();
-               } elseif ($this->formEnabled === FALSE) {
+               } elseif ($this->formEnabled === false) {
                        if ($this->ifSubGroupOpenedPreviously()) {
                                // Close sub group
                                $this->addFormSubGroup();