WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
File tree Expand file tree Collapse file tree 7 files changed +157
-0
lines changed
ApiOverview/Events/Events/Form
_BeforeFormIsCreatedEvent Expand file tree Collapse file tree 7 files changed +157
-0
lines changed Original file line number Diff line number Diff line change 1+ .. include :: /Includes.rst.txt
2+ .. index :: Events; BeforeFormIsCreatedEvent
3+
4+ .. _BeforeFormIsCreatedEvent :
5+
6+ ========================
7+ BeforeFormIsCreatedEvent
8+ ========================
9+
10+ .. versionadded :: 14.0
11+ The event :php-short: `TYPO3\C MS\F orm\E vent\B eforeFormIsCreatedEvent `
12+ serves as a direct replacement for the removed hook
13+ :php: `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/form']['beforeFormCreate'] `.
14+
15+ The event :php-short: `TYPO3\C MS\F orm\E vent\B eforeFormIsCreatedEvent ` allows a
16+ to modify a form before it gets created. The event is dispatched just right
17+ before a new form is created in the backend.
18+
19+ .. seealso ::
20+ * `BeforeFormIsSavedEvent <https://docs.typo3.org/permalink/t3coreapi:beforeformissavedevent >`_
21+ is called right before a form is saved in the backend form editor.
22+ * The backend form editor is described in detail in the `TYPO3 Form manual
23+ - Form editor <https://docs.typo3.org/permalink/typo3/cms-form:apireference-formeditor> `_.
24+
25+ .. _BeforeFormIsCreatedEvent-example :
26+
27+ Example
28+ =======
29+
30+ .. literalinclude :: _BeforeFormIsCreatedEvent/_MyEventListener.php
31+ :language: php
32+ :caption: EXT:my_extension/Classes/EventListener/MyEventListener.php
33+
34+ .. include :: /_includes/EventsAttributeAddedNew.rst.txt
35+
36+ .. _BeforeFormIsCreatedEvent-api :
37+
38+ API
39+ ===
40+
41+ .. include :: /CodeSnippets/Events/Form/BeforeFormIsCreatedEvent.rst.txt
Original file line number Diff line number Diff line change 1+ .. include :: /Includes.rst.txt
2+ .. index :: Events; BeforeFormIsSavedEvent
3+
4+ .. _BeforeFormIsSavedEvent :
5+
6+ ======================
7+ BeforeFormIsSavedEvent
8+ ======================
9+
10+ .. versionadded :: 14.0
11+ The event :php-short: `TYPO3\C MS\F orm\E vent\B eforeFormIsSavedEvent `
12+ serves as a direct replacement for the removed hook
13+ :php: `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/form']['beforeFormSave'] `.
14+
15+ The event :php-short: `TYPO3\C MS\F orm\E vent\B eforeFormIsSavedEvent ` allows a
16+ to modify a form definition as well as the form persistence identifier before
17+ it gets saved. It is dispatched just right before a form is saved in the backend.
18+
19+ .. seealso ::
20+ * `BeforeFormIsCreatedEvent <https://docs.typo3.org/permalink/t3coreapi:beforeformiscreatedevent >`_
21+ is called right before a form is created in the backend form editor.
22+ * The backend form editor is described in detail in the `TYPO3 Form manual
23+ - Form editor <https://docs.typo3.org/permalink/typo3/cms-form:apireference-formeditor> `_.
24+
25+ .. _BeforeFormIsSavedEvent-example :
26+
27+ Example
28+ =======
29+
30+ .. literalinclude :: _BeforeFormIsSavedEvent/_MyEventListener.php
31+ :caption: EXT:my_extension/Classes/EventListener/MyEventListener.php
32+
33+ .. include :: /_includes/EventsAttributeAddedNew.rst.txt
34+
35+ .. _BeforeFormIsSavedEvent-api :
36+
37+ API
38+ ===
39+
40+ .. include :: /CodeSnippets/Events/Form/BeforeFormIsSavedEvent.rst.txt
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace MyVendor \MyExtension \EventListener ;
6+
7+ use TYPO3 \CMS \Core \Attribute \AsEventListener ;
8+ use TYPO3 \CMS \Form \Event \BeforeFormIsCreatedEvent ;
9+
10+ #[AsEventListener(
11+ identifier: 'my-extension/before-form-is-created ' ,
12+ )]
13+ final readonly class MyEventListener
14+ {
15+ public function __invoke (BeforeFormIsCreatedEvent $ event ): void
16+ {
17+ $ event ->form ['label ' ] = 'foo ' ;
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace MyVendor \MyExtension \EventListener ;
6+
7+ use TYPO3 \CMS \Core \Attribute \AsEventListener ;
8+ use TYPO3 \CMS \Form \Event \BeforeFormIsSavedEvent ;
9+
10+ #[AsEventListener(
11+ identifier: 'my-extension/before-form-is-saved ' ,
12+ )]
13+ final readonly class MyEventListener
14+ {
15+ public function __invoke (BeforeFormIsSavedEvent $ event ): void
16+ {
17+ $ event ->form ['label ' ] = 'foo ' ;
18+ }
19+ }
Original file line number Diff line number Diff line change 77 'targetFileName ' => 'CodeSnippets/Events/Form/AfterFormDefinitionLoadedEvent.rst.txt ' ,
88 'withCode ' => false ,
99 ],
10+ [
11+ 'action ' => 'createPhpClassDocs ' ,
12+ 'class ' => \TYPO3 \CMS \Form \Event \BeforeFormIsSavedEvent::class,
13+ 'targetFileName ' => 'CodeSnippets/Events/Form/BeforeFormIsSavedEvent.rst.txt ' ,
14+ 'withCode ' => false ,
15+ ],
16+ [
17+ 'action ' => 'createPhpClassDocs ' ,
18+ 'class ' => \TYPO3 \CMS \Form \Event \BeforeFormIsCreatedEvent::class,
19+ 'targetFileName ' => 'CodeSnippets/Events/Form/BeforeFormIsCreatedEvent.rst.txt ' ,
20+ 'withCode ' => false ,
21+ ],
1022];
Original file line number Diff line number Diff line change 1+ .. Generated by https://github.com/TYPO3-Documentation/t3docs-codesnippets
2+ .. php :namespace :: TYPO3\CMS\Form\Event
3+
4+ .. php :class :: BeforeFormIsCreatedEvent
5+
6+ Listeners to this Event will be able to modify the form definition
7+ and persistence identifier before a new form is created.
8+
9+ .. php :attr :: formPersistenceIdentifier
10+ :public:
11+
12+ .. php :attr :: form
13+ :public:
Original file line number Diff line number Diff line change 1+ .. Generated by https://github.com/TYPO3-Documentation/t3docs-codesnippets
2+ .. php :namespace :: TYPO3\CMS\Form\Event
3+
4+ .. php :class :: BeforeFormIsSavedEvent
5+
6+ Listeners to this Event will be able to modify the form definition
7+ and persistence identifier before a form is saved.
8+
9+ .. php :attr :: formPersistenceIdentifier
10+ :public:
11+
12+ .. php :attr :: form
13+ :public:
You can’t perform that action at this time.
0 commit comments