‪TYPO3CMS  11.5
FormState.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 /*
19  * Inspired by and partially taken from the Neos.Form package (www.neos.io)
20  */
21 
23 
26 
36 {
41  public const ‪NOPAGE = -1;
42 
49 
53  protected ‪$formValues = [];
54 
58  public function ‪isFormSubmitted(): bool
59  {
60  return $this->lastDisplayedPageIndex !== ‪self::NOPAGE;
61  }
62 
66  public function ‪getLastDisplayedPageIndex(): int
67  {
69  }
70 
75  {
76  $this->lastDisplayedPageIndex = ‪$lastDisplayedPageIndex;
77  }
78 
82  public function ‪getFormValues(): array
83  {
84  return ‪$this->formValues;
85  }
86 
91  public function ‪setFormValue(string $propertyPath, $value)
92  {
93  $this->formValues = ‪ArrayUtility::setValueByPath(
94  $this->formValues,
95  $propertyPath,
96  $value,
97  '.'
98  );
99  }
100 
105  public function ‪getFormValue(string $propertyPath)
106  {
107  try {
108  return ‪ArrayUtility::getValueByPath($this->formValues, $propertyPath, '.');
109  } catch (MissingArrayPathException $exception) {
110  return null;
111  }
112  }
113 }
‪TYPO3\CMS\Form\Domain\Runtime\FormState\setFormValue
‪setFormValue(string $propertyPath, $value)
Definition: FormState.php:89
‪TYPO3\CMS\Form\Domain\Runtime\FormState\isFormSubmitted
‪bool isFormSubmitted()
Definition: FormState.php:56
‪TYPO3\CMS\Form\Domain\Runtime\FormState\NOPAGE
‪const NOPAGE
Definition: FormState.php:41
‪TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException
Definition: MissingArrayPathException.php:27
‪TYPO3\CMS\Form\Domain\Runtime\FormState\$formValues
‪array $formValues
Definition: FormState.php:51
‪TYPO3\CMS\Form\Domain\Runtime\FormState
Definition: FormState.php:36
‪TYPO3\CMS\Form\Domain\Runtime\FormState\setLastDisplayedPageIndex
‪setLastDisplayedPageIndex(int $lastDisplayedPageIndex)
Definition: FormState.php:72
‪TYPO3\CMS\Form\Domain\Runtime\FormState\$lastDisplayedPageIndex
‪int $lastDisplayedPageIndex
Definition: FormState.php:47
‪TYPO3\CMS\Form\Domain\Runtime
‪TYPO3\CMS\Core\Utility\ArrayUtility\getValueByPath
‪static mixed getValueByPath(array $array, $path, $delimiter='/')
Definition: ArrayUtility.php:180
‪TYPO3\CMS\Form\Domain\Runtime\FormState\getFormValue
‪mixed getFormValue(string $propertyPath)
Definition: FormState.php:103
‪TYPO3\CMS\Form\Domain\Runtime\FormState\getFormValues
‪array getFormValues()
Definition: FormState.php:80
‪TYPO3\CMS\Core\Utility\ArrayUtility\setValueByPath
‪static array setValueByPath(array $array, $path, $value, $delimiter='/')
Definition: ArrayUtility.php:272
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:24
‪TYPO3\CMS\Form\Domain\Runtime\FormState\getLastDisplayedPageIndex
‪int getLastDisplayedPageIndex()
Definition: FormState.php:64