Skip to content

Commit

Permalink
Typo3v12 Alpha 2 (#78)
Browse files Browse the repository at this point in the history
* Added debugger output to template

* Added PrintToScreenDebugger

* boolval => filter_var

* Added more DocBlocks

* Split up GeneralOptions DocBlock

* Added maxDepth support to PrintToScreenDebugger

* Activate search
  • Loading branch information
tlueder authored Jul 5, 2023
1 parent 175e076 commit 5567228
Show file tree
Hide file tree
Showing 81 changed files with 3,857 additions and 1,334 deletions.
320 changes: 25 additions & 295 deletions Classes/Controller/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,39 @@
*Documentation:End
*/
/** Documentation:Start:GeneralOptions/Index.rst.
*
*.. include:: /Includes.rst.txt
*
*.. _general-options:
*
*===============
*General Options
*===============
*
*
*All forms are build via TypoScript as predefined forms.
*
*
*.. toctree::
* :maxdepth: 2
* :hidden:
*
* Settings
* PredefinedForm
* Step
*
*Documentation:End
*/
/** Documentation:Start:GeneralOptions/Settings.rst.
*
*.. include:: /Includes.rst.txt
*
*.. _settings:
*
*========
*Settings
*========
*
*All forms are build via TypoScript as predefined forms.
*
*.. list-table::
* :align: left
* :width: 100%
Expand Down Expand Up @@ -197,7 +216,7 @@
* :stub-columns: 0
*
* * - **predefinedForm**
* - See `Predefined Forms <predefined-forms-label_>`__
* - See :ref:`Predefined-Form`
* * -
* -
* * - *Mandatory*
Expand Down Expand Up @@ -273,296 +292,6 @@
* * - *Data Type*
* - MailModel
*
*Predefined Forms
*================
*
*.. _predefined-forms-label:
*
*.. list-table::
* :align: left
* :width: 100%
* :widths: 20 80
* :header-rows: 0
* :stub-columns: 0
*
* * - **TypoScript Path**
* - plugin.tx_formhandler_form.settings.predefinedForms.FormName
*
*.. code-block:: typoscript
*
* Example Code:
*
* plugin.tx_formhandler_form.settings.predefinedForms.devExample {
* formId = DevExampleForm
* formName = Dev Example Form
* formValuesPrefix = DevExampleForm
* langFileDefault = locallang_example_form.xlf
* templateForm = DevExample/Default
* templateMailHtml = DevExample/MailHtml
* templateMailText = DevExample/MailText
*
* debuggers {
* }
*
* steps {
* 1 {
* templateForm = DevExampleForm/DevExampleHTMLStep1
* validators {
* DefaultValidator {
* model = DefaultValidatorModel
* config {
* messageLimit = 1
* messageLimits {
* 1.customer.email = 2
* }
* fields {
* customer.fields {
* firstname.errorChecks {
* required {
* model = RequiredModel
* }
* maxLength {
* model = MaxLengthModel
* maxLength = 20
* }
* }
* lastname.errorChecks {
* required {
* model = RequiredModel
* }
* maxLength {
* model = MaxLengthModel
* maxLength = 20
* }
* }
* streetAddress.errorChecks {
* required {
* model = RequiredModel
* }
* }
* postalCode.errorChecks {
* required {
* model = RequiredModel
* }
* }
* city.errorChecks {
* required {
* model = RequiredModel
* }
* maxLength {
* model = MaxLengthModel
* maxLength = 70
* }
* }
* country.errorChecks {
* required {
* model = RequiredModel
* }
* }
* telephone.errorChecks {
* required {
* model = RequiredModel
* }
* maxLength {
* model = MaxLengthModel
* maxLength = 20
* }
* }
* email.errorChecks {
* required {
* model = RequiredModel
* }
* maxLength {
* model = MaxLengthModel
* maxLength = 50
* }
* email {
* model = EmailModel
* }
* }
* }
* }
* }
* }
* }
* }
* }
*
* finishers {
* Mail {
* model = MailFinisherModel
* }
* Redirect {
* model = RedirectFinisherModel
* config {
* returns = true
* correctRedirectUrl = false
* additionalParams {
* postal_code = 1.customer.postalCode
* queryParam2 = valueIfNotFoundAsFieldName
* }
* }
* }
* }
* }
*
***Properties**
*
*.. list-table::
* :align: left
* :width: 100%
* :widths: 20 80
* :header-rows: 0
* :stub-columns: 0
*
* * - **formId**
* - Value of the id attribute of the form tag.
* * -
* -
* * - *Mandatory*
* - True
* * - *Data Type*
* - String
*
*.. list-table::
* :align: left
* :width: 100%
* :widths: 20 80
* :header-rows: 0
* :stub-columns: 0
*
* * - **formName**
* - Value of the name shown in the dropdown list.
* * -
* -
* * - *Mandatory*
* - True
* * - *Data Type*
* - String
*
*.. list-table::
* :align: left
* :width: 100%
* :widths: 20 80
* :header-rows: 0
* :stub-columns: 0
*
* * - **formValuesPrefix**
* - Prefix of form fields. Use this if you use a prefix for your forms to avoid conflicts with other plugins. Settings this option you will be able to use only the fieldname in all markers and do not need to add prefix.
* * -
* -
* * - *Mandatory*
* - False
* * - *Data Type*
* - String
* * - *Default*
* - tx_formhandler_form
* * - *Note*
* - It is highly recommended to use this setting!
*
*.. list-table::
* :align: left
* :width: 100%
* :widths: 20 80
* :header-rows: 0
* :stub-columns: 0
*
* * - **langFileDefault**
* - Path to default language file, can be altered as parameter by the form fields.
* * -
* -
* * - *Mandatory*
* - False
* * - *Data Type*
* - String
*
*.. list-table::
* :align: left
* :width: 100%
* :widths: 20 80
* :header-rows: 0
* :stub-columns: 0
*
* * - **debuggers**
* - A list of :ref:`Debuggers` for the predefined forms.
* * -
* -
* * - *Mandatory*
* - False
* * - *Data Type*
* - Array<String, :ref:`Debugger <Debuggers>`>
*
*.. list-table::
* :align: left
* :width: 100%
* :widths: 20 80
* :header-rows: 0
* :stub-columns: 0
*
* * - **steps**
* - You can split a form into as many steps as you like and add as many :ref:`Validators` as you like to each step, but even if the form has just one step it must be defined to add :ref:`Validators`.
* * -
* -
* * - *Mandatory*
* - True (Only if a form has needs :ref:`Validators`, otherwise not.)
* * - *Data Type*
* - Array<Integer, `Step <step-label_>`__>
* * - *Note*
* - The key Integer in Array<Integer, `Step <step-label_>`__> starts at 1 for first step.
*
*.. list-table::
* :align: left
* :width: 100%
* :widths: 20 80
* :header-rows: 0
* :stub-columns: 0
*
* * - **finishers**
* - A list of :ref:`Finishers` for the predefined forms.
* * -
* -
* * - *Mandatory*
* - False
* * - *Data Type*
* - Array<String, :ref:`Finisher <Finishers>`>
*
*Step
*====
*
*.. _step-label:
*
*.. list-table::
* :align: left
* :width: 100%
* :widths: 20 80
* :header-rows: 0
* :stub-columns: 0
*
* * - **templateForm**
* - The template for a given step.
* * -
* -
* * - *Mandatory*
* - False
* * - *Data Type*
* - String
*
*.. list-table::
* :align: left
* :width: 100%
* :widths: 20 80
* :header-rows: 0
* :stub-columns: 0
*
* * - **validators**
* - A list of :ref:`Validators` for a given step.
* * -
* -
* * - *Mandatory*
* - False
* * - *Data Type*
* - Array<String, :ref:`Validator <Validators>`>
*
*Documentation:End
*/
class FormController extends ActionController {
Expand Down Expand Up @@ -672,11 +401,12 @@ public function formAction(): ResponseInterface {
}
}

$this->formConfig->processDebugLog();
$debugOutput = $this->formConfig->processDebugLog();

// Prepare output
$this->view->assignMultiple(
[
'debugOutput' => $debugOutput,
'fieldsRequired' => $this->fieldsRequired,
'fieldsErrors' => $this->formConfig->fieldsErrors,
'fieldSets' => $this->formConfig->fieldSets,
Expand Down Expand Up @@ -800,7 +530,7 @@ private function formStepIsLast(): bool {

private function formSubmitted(): bool {
if (is_array($this->parsedBody[FormhandlerExtensionConfig::EXTENSION_KEY] ?? false)) {
return boolval($this->parsedBody[FormhandlerExtensionConfig::EXTENSION_KEY]['submitted'] ?? false);
return filter_var($this->parsedBody[FormhandlerExtensionConfig::EXTENSION_KEY]['submitted'] ?? false, FILTER_VALIDATE_BOOLEAN);
}

return false;
Expand Down
5 changes: 2 additions & 3 deletions Classes/Debugger/AbstractDebugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Typoheads\Formhandler\Debugger;

use TYPO3\CMS\Core\SingletonInterface;
use Typoheads\Formhandler\Definitions\Severity;
use Typoheads\Formhandler\Domain\Model\Config\Debugger\AbstractDebuggerModel;
use Typoheads\Formhandler\Domain\Model\Config\FormModel;

Expand All @@ -25,9 +24,9 @@ public function init(
}

/**
* @param array<string, array<int, array{message: string, severity: Severity, data: array<int|string, mixed>|object|string}>> $debugLog
* @param array<string, array<int, array{message: string, severity: int, data: array<int|string, mixed>|object|string}>> $debugLog
*/
abstract public function processDebugLog(
array $debugLog,
): void;
): ?string;
}
Loading

0 comments on commit 5567228

Please sign in to comment.