1<?php 2declare(strict_types = 1); 3namespace TYPO3\CMS\Form\Domain\Model\FormElements; 4 5/* 6 * This file is part of the TYPO3 CMS project. 7 * 8 * It originated from the Neos.Form package (www.neos.io) 9 * 10 * It is free software; you can redistribute it and/or modify it under 11 * the terms of the GNU General Public License, either version 2 12 * of the License, or any later version. 13 * 14 * For the full copyright and license information, please read the 15 * LICENSE.txt file that was distributed with this source code. 16 * 17 * The TYPO3 project - inspiring people to share! 18 */ 19 20use TYPO3\CMS\Form\Domain\Model\FormDefinition; 21use TYPO3\CMS\Form\Domain\Model\Renderable\CompositeRenderableInterface; 22use TYPO3\CMS\Form\Exception as FormException; 23 24/** 25 * A Page, being part of a bigger FormDefinition. It contains numerous FormElements 26 * as children. 27 * 28 * A FormDefinition consists of multiple Pages, where only one page is visible 29 * at any given time. 30 * 31 * Most of the API of this object is implemented in {@link AbstractSection}, 32 * so make sure to review this class as well. 33 * 34 * Please see {@link FormDefinition} for an in-depth explanation. 35 * 36 * Scope: frontend 37 * **This class is NOT meant to be sub classed by developers.** 38 */ 39class Page extends AbstractSection 40{ 41 42 /** 43 * Constructor. Needs this Page's identifier 44 * 45 * @param string $identifier The Page's identifier 46 * @param string $type The Page's type 47 * @throws \TYPO3\CMS\Form\Domain\Exception\IdentifierNotValidException if the identifier was no non-empty string 48 */ 49 public function __construct(string $identifier, string $type = 'Page') 50 { 51 parent::__construct($identifier, $type); 52 } 53 54 /** 55 * Set the parent renderable 56 * 57 * @param CompositeRenderableInterface $parentRenderable 58 * @throws FormException 59 */ 60 public function setParentRenderable(CompositeRenderableInterface $parentRenderable) 61 { 62 if (!($parentRenderable instanceof FormDefinition)) { 63 throw new FormException(sprintf('The specified parentRenderable must be a FormDefinition, got "%s"', is_object($parentRenderable) ? get_class($parentRenderable) : gettype($parentRenderable)), 1329233747); 64 } 65 parent::setParentRenderable($parentRenderable); 66 } 67} 68