‪TYPO3CMS  9.5
GridContainer.php
Go to the documentation of this file.
1 <?php
2 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 
19 
29 {
35  public function ‪initializeFormElement()
36  {
37  trigger_error(
38  '"GridContainer" form elements will be removed in TYPO3 v10.0. Use "GridRow" form elements instead.',
39  E_USER_DEPRECATED
40  );
41  parent::initializeFormElement();
42  }
43 
50  public function ‪registerInFormIfPossible()
51  {
52  foreach ($this->‪getElementsRecursively() as $renderable) {
53  if ($renderable instanceof ‪GridContainerInterface) {
55  sprintf('Grid containers ("%s") within grid containers ("%s") are not allowed.', $renderable->getIdentifier(), $this->getIdentifier()),
56  1489412790
57  );
58  }
59  }
60  parent::registerInFormIfPossible();
61  }
62 
68  public function ‪addElement(‪FormElementInterface $formElement)
69  {
70  if (!$formElement instanceof ‪GridRowInterface) {
72  sprintf('The "implementationClassName" for element "%s" (type "%s") does not implement the GridRowInterface.', $formElement->‪getIdentifier(), $formElement->‪getType()),
73  1489486301
74  );
75  }
76  $this->‪addRenderable($formElement);
77  }
78 
87  public function ‪createElement(string ‪$identifier, string $typeName): ‪FormElementInterface
88  {
89  $element = parent::createElement(‪$identifier, $typeName);
90 
91  if (!$element instanceof ‪GridRowInterface) {
93  sprintf('The "implementationClassName" for element "%s" (type "%s") does not implement the GridRowInterface.', ‪$identifier, $typeName),
94  1489486302
95  );
96  }
97  return $element;
98  }
99 }
‪TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection\getElementsRecursively
‪FormElementInterface[] getElementsRecursively()
Definition: AbstractSection.php:74
‪TYPO3\CMS\Form\Domain\Model\FormElements\Section
Definition: Section.php:35
‪TYPO3\CMS\Form\Domain\Model\FormElements\GridContainer\initializeFormElement
‪initializeFormElement()
Definition: GridContainer.php:35
‪TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface\getIdentifier
‪string getIdentifier()
‪TYPO3\CMS\Form\Domain\Model\FormElements\GridContainer\addElement
‪addElement(FormElementInterface $formElement)
Definition: GridContainer.php:68
‪TYPO3\CMS\Form\Domain\Model\FormElements\GridContainer\createElement
‪FormElementInterface createElement(string $identifier, string $typeName)
Definition: GridContainer.php:87
‪TYPO3\CMS\Form\Domain\Model\FormElements\FormElementInterface
Definition: FormElementInterface.php:36
‪TYPO3\CMS\Form\Domain\Model\FormElements\GridContainerInterface
Definition: GridContainerInterface.php:22
‪TYPO3\CMS\Form\Domain\Model\FormElements\GridRowInterface
Definition: GridRowInterface.php:22
‪TYPO3\CMS\Form\Domain\Model\FormElements\GridContainer\registerInFormIfPossible
‪registerInFormIfPossible()
Definition: GridContainer.php:50
‪TYPO3\CMS\Form\Domain\Model\FormElements\GridContainer
Definition: GridContainer.php:29
‪TYPO3\CMS\Form\Domain\Exception\TypeDefinitionNotValidException
Definition: TypeDefinitionNotValidException.php:27
‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\$identifier
‪string $identifier
Definition: AbstractRenderable.php:52
‪TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface\getType
‪string getType()
‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractCompositeRenderable\addRenderable
‪addRenderable(RenderableInterface $renderable)
Definition: AbstractCompositeRenderable.php:48
‪TYPO3\CMS\Form\Domain\Model\FormElements
Definition: AbstractFormElement.php:3