Skip to content

Commit e475283

Browse files
authored
KickstartingExtbaseExtension.md
1 parent c7e3ac3 commit e475283

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Create an Extbase Plugin with friendsoftypo3/kickstarter
2+
3+
<!-- #TYPO3v13 #Advanced #kickstarter #Extbase #Plugin #Configuration @lina.wolf -->
4+
5+
Create an extension using friendsoftypo3/kickstarter witch features an Extbase Plugin.
6+
7+
## Learning objective
8+
9+
In this step-by-step guide you will learn to write a custom extension with the Kickstarter.
10+
11+
## Prerequisites
12+
13+
### Tools and technology
14+
15+
* TYPO3 13.4 Composer based installation
16+
17+
### Knowledge and skills
18+
19+
* PHP Development
20+
21+
## Install the Kickstarter extension
22+
23+
Install kickstarter:
24+
25+
```
26+
ddev composer req friendsoftypo3/kickstarter@dev-main
27+
```
28+
29+
Go to the backend module `Admin Tools > Settings > Extension Configuration`, edit the "Kickstarter"
30+
settings and user path `packages` as "Export Directory".
31+
32+
## Create a basic extension
33+
34+
```
35+
ddev typo3 make:extension
36+
```
37+
38+
When prompted answer the questions, note the composer name you entered.
39+
40+
## Install you newly created extension
41+
42+
```
43+
ddev composer require myvendor/myextension
44+
```
45+
46+
## Create a site set
47+
48+
```
49+
ddev typo3 make:site-set
50+
```
51+
52+
## Depend on the site set from your site
53+
54+
Go to backend module `Site Management > Sites` and edit your site. In section "Sets for this Site"
55+
choose your newly created site set.
56+
57+
## Create an Extbase Controller
58+
59+
```
60+
ddev typo3 make:controller
61+
```
62+
63+
Create a new Extbase Controller with name `CalculatorController`
64+
65+
When prompted create two actions:
66+
67+
* form
68+
* result
69+
70+
## Create an Extbase Plugin
71+
72+
```
73+
ddev typo3 make:plugin
74+
```
75+
76+
Choose the controller you just created. Include both actions, action "result" should not be cached.
77+
78+
When prompted place the TypoScript into the site set you created earlier.
79+
80+
## Create Fluid templates
81+
82+
Using an editor create two Fluid templates and put them into folder `packages/my_extension/Ressources/Private/Templates/`
83+
84+
* Form.html
85+
* Result.html
86+
87+
Put some example output into these forms.
88+
89+
## Include the plugin into your page
90+
91+
Clear all caches:
92+
93+
```
94+
ddev typo3 cache:flush
95+
```
96+
97+
## Summary
98+
99+
Go to a page on your site and insert the plugin there using the "New Content element wizard". When you
100+
preview the page you should see the Content of the Form.html template.
101+
102+
Congratulations! You now have now created a basic Extbase plugin.
103+
104+
## Next steps
105+
106+
Now that you have created a basic plugin, you might like to:
107+
108+
* Fill the Controller with life
109+
* Attach a Service that does some actual calculation
110+
* Use a Data Transfer Object (DTO) to pass data around
111+
* Temporarily store the data in the user session
112+
* Permanently store the data into the database
113+
114+
## Resources
115+
116+
* [Kickstarter](https://github.com/FriendsOfTYPO3/kickstarter)
117+
* [The finished example extension "bmi_caluclator"](https://github.com/TYPO3-Documentation/bmi_calculator/tree/main)
118+
* [Site sets ](https://docs.typo3.org/permalink/t3coreapi:site-sets)
119+
* [Extbase controller ](https://docs.typo3.org/permalink/t3coreapi:extbase-controller)
120+
* [Registration of frontend plugins ](https://docs.typo3.org/permalink/t3coreapi:extbase-registration-of-frontend-plugins)

0 commit comments

Comments
 (0)