[FEATURE] EXT:form - integrate new form framework
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / Domain / Model / Renderable / RenderableInterface.php
1 <?php
2 declare(strict_types=1);
3 namespace TYPO3\CMS\Form\Domain\Model\Renderable;
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 * Base interface which all Form Parts except the FormDefinition must adhere
20 * to (i.e. all elements which are NOT the root of a Form).
21 *
22 * Scope: frontend
23 * **This class is NOT meant to be sub classed by developers.**
24 */
25 interface RenderableInterface extends RootRenderableInterface
26 {
27
28 /**
29 * Return the parent renderable
30 *
31 * @return null|CompositeRenderableInterface the parent renderable
32 * @internal
33 */
34 public function getParentRenderable();
35
36 /**
37 * Set the new parent renderable. You should not call this directly;
38 * it is automatically called by addRenderable.
39 *
40 * This method should also register itself at the parent form, if possible.
41 *
42 * @param CompositeRenderableInterface $renderable
43 * @return void
44 * @internal
45 */
46 public function setParentRenderable(CompositeRenderableInterface $renderable);
47
48 /**
49 * Set the index of this renderable inside the parent renderable
50 *
51 * @param int $index
52 * @return void
53 * @internal
54 */
55 public function setIndex(int $index);
56
57 /**
58 * Get the index inside the parent renderable
59 *
60 * @return int
61 * @api
62 */
63 public function getIndex(): int;
64
65 /**
66 * This function is called after a renderable has been removed from its parent
67 * renderable. The function should make sure to clean up the internal state,
68 * like reseting $this->parentRenderable or deregistering the renderable
69 * at the form.
70 *
71 * @return void
72 * @internal
73 */
74 public function onRemoveFromParentRenderable();
75
76 /**
77 * This is a callback that is invoked by the Form Factory after the whole form has been built.
78 * It can be used to add new form elements as children for complex form elements.
79 *
80 * @return void
81 * @api
82 */
83 public function onBuildingFinished();
84
85 /**
86 * Register this element at the parent form, if there is a connection to the parent form.
87 *
88 * @return void
89 * @internal
90 */
91 public function registerInFormIfPossible();
92 }