‪TYPO3CMS  10.4
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 {
37 
42  const ‪NOPAGE = -1;
43 
50 
54  protected ‪$formValues = [];
55 
59  public function ‪isFormSubmitted(): bool
60  {
61  return $this->lastDisplayedPageIndex !== ‪self::NOPAGE;
62  }
63 
67  public function ‪getLastDisplayedPageIndex(): int
68  {
70  }
71 
76  {
77  $this->lastDisplayedPageIndex = ‪$lastDisplayedPageIndex;
78  }
79 
83  public function ‪getFormValues(): array
84  {
85  return ‪$this->formValues;
86  }
87 
92  public function ‪setFormValue(string $propertyPath, $value)
93  {
94  $this->formValues = ‪ArrayUtility::setValueByPath(
95  $this->formValues,
96  $propertyPath,
97  $value,
98  '.'
99  );
100  }
101 
106  public function ‪getFormValue(string $propertyPath)
107  {
108  try {
109  return ‪ArrayUtility::getValueByPath($this->formValues, $propertyPath, '.');
110  } catch (MissingArrayPathException $exception) {
111  return null;
112  }
113  }
114 }
‪TYPO3\CMS\Form\Domain\Runtime\FormState\setFormValue
‪setFormValue(string $propertyPath, $value)
Definition: FormState.php:90
‪TYPO3\CMS\Form\Domain\Runtime\FormState\isFormSubmitted
‪bool isFormSubmitted()
Definition: FormState.php:57
‪TYPO3\CMS\Form\Domain\Runtime\FormState\NOPAGE
‪const NOPAGE
Definition: FormState.php:42
‪TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException
Definition: MissingArrayPathException.php:28
‪TYPO3\CMS\Form\Domain\Runtime\FormState\$formValues
‪array $formValues
Definition: FormState.php:52
‪TYPO3\CMS\Form\Domain\Runtime\FormState
Definition: FormState.php:36
‪TYPO3\CMS\Form\Domain\Runtime\FormState\setLastDisplayedPageIndex
‪setLastDisplayedPageIndex(int $lastDisplayedPageIndex)
Definition: FormState.php:73
‪TYPO3\CMS\Form\Domain\Runtime\FormState\$lastDisplayedPageIndex
‪int $lastDisplayedPageIndex
Definition: FormState.php:48
‪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:104
‪TYPO3\CMS\Form\Domain\Runtime\FormState\getFormValues
‪array getFormValues()
Definition: FormState.php:81
‪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:65