[CLEANUP] Alwas put null at the last position
[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 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
20 /**
21 * Base interface which all Form Parts except the FormDefinition must adhere
22 * to (i.e. all elements which are NOT the root of a Form).
23 *
24 * Scope: frontend
25 * **This class is NOT meant to be sub classed by developers.**
26 */
27 interface RenderableInterface extends RootRenderableInterface
28 {
29
30 /**
31 * Return the parent renderable
32 *
33 * @return CompositeRenderableInterface|null the parent renderable
34 * @internal
35 */
36 public function getParentRenderable();
37
38 /**
39 * Set the new parent renderable. You should not call this directly;
40 * it is automatically called by addRenderable.
41 *
42 * This method should also register itself at the parent form, if possible.
43 *
44 * @param CompositeRenderableInterface $renderable
45 * @internal
46 */
47 public function setParentRenderable(CompositeRenderableInterface $renderable);
48
49 /**
50 * Set the index of this renderable inside the parent renderable
51 *
52 * @param int $index
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 * @internal
72 */
73 public function onRemoveFromParentRenderable();
74
75 /**
76 * This is a callback that is invoked by the Form Factory after the whole form has been built.
77 * It can be used to add new form elements as children for complex form elements.
78 *
79 * @api
80 * @deprecated since TYPO3 v8, will be removed in TYPO3 v9
81 */
82 public function onBuildingFinished();
83
84 /**
85 * Register this element at the parent form, if there is a connection to the parent form.
86 *
87 * @internal
88 */
89 public function registerInFormIfPossible();
90
91 /**
92 * Get the template name of the renderable
93 *
94 * @return string
95 * @api
96 */
97 public function getTemplateName(): string;
98 }