TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
FormState.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types=1);
3 namespace TYPO3\CMS\Form\Domain\Runtime;
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 
19 
28 class FormState
29 {
30 
35  const NOPAGE = -1;
36 
42  protected $lastDisplayedPageIndex = self::NOPAGE;
43 
47  protected $formValues = [];
48 
52  public function isFormSubmitted(): bool
53  {
54  return $this->lastDisplayedPageIndex !== self::NOPAGE;
55  }
56 
60  public function getLastDisplayedPageIndex(): int
61  {
63  }
64 
70  {
71  $this->lastDisplayedPageIndex = $lastDisplayedPageIndex;
72  }
73 
77  public function getFormValues(): array
78  {
79  return $this->formValues;
80  }
81 
87  public function setFormValue(string $propertyPath, $value)
88  {
89  $this->formValues = ArrayUtility::setValueByPath(
90  $this->formValues,
91  $propertyPath,
92  $value,
93  '.'
94  );
95  }
96 
101  public function getFormValue(string $propertyPath)
102  {
103  try {
104  return ArrayUtility::getValueByPath($this->formValues, $propertyPath, '.');
105  } catch (\RuntimeException $exception) {
106  return null;
107  }
108  }
109 }
getFormValue(string $propertyPath)
Definition: FormState.php:101
static getValueByPath(array $array, $path, $delimiter= '/')
setFormValue(string $propertyPath, $value)
Definition: FormState.php:87
setLastDisplayedPageIndex(int $lastDisplayedPageIndex)
Definition: FormState.php:69
static setValueByPath(array $array, $path, $value, $delimiter= '/')