You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -10,31 +9,36 @@ You’ll need the MetaModels core and some attributes / filter to get MetaModels
10
9
Don’t forget to run composer install through „Update packages“.
11
10
When installed, run the database update and your MetaModels installation is done.
12
11
13
-
.. note:: If you know that you don’t need all attributes and / or filter you can install every single package by it’s own.*
12
+
.. note:: If you know that you don’t need all attributes and/or filter you can install every single package by it’s own.
14
13
15
14
Your first MetaModel
16
-
=====================
15
+
====================
17
16
18
17
Create MetaModels
19
18
-----------------
20
-
To get started with MetaModels we need at least one MetaModel, jai! We will build a small MetaModel, non translated, MetaModel for real estate references.
19
+
To get started with MetaModels we need at least one MetaModel, jai! We will build a small MetaModel, non translated,
20
+
MetaModel for real estate references.
21
21
22
22
In our example we need two MetaModels:
23
23
24
-
- reference (the MetaModel which contain the real estate objects)
25
-
- category (the MetaModel to define categories for references)
24
+
:reference:
25
+
(the MetaModel which contain the real estate objects)
26
+
:category:
27
+
(the MetaModel to define categories for references)
26
28
27
29
Create reference and category metamodels.
28
30
29
31
Create attributes
30
32
-----------------
31
33
32
-
An (empty) MetaModel is just a container for your data objects. But before you can store data in your MetaModel, you need to define some types of data which you like to store.
34
+
An (empty) MetaModel is just a container for your data objects. But before you can store data in your MetaModel, you
35
+
need to define some types of data which you like to store.
33
36
34
-
In MetaModels there are several „attributes“ to store different kind of data. Most of the time you need at least a text attribute (e.g. to store a name).
37
+
In MetaModels there are several „attributes“ to store different kind of data. Most of the time you need at least a
38
+
text attribute (e.g. to store a name).
35
39
36
40
mm_reference
37
-
^^^^^^^^^^^^^
41
+
^^^^^^^^^^^^
38
42
Our reference will contain these attributes:
39
43
40
44
* Name (text)
@@ -48,239 +52,251 @@ Our reference will contain these attributes:
48
52
49
53
**Name**
50
54
51
-
Attribute Type: text
52
-
Column Name: name
53
-
Name: Name
54
-
Description: Name of reference
55
+
:Attribute Type: text
56
+
:Column Name: name
57
+
:Name: Name
58
+
:Description: Name of reference
55
59
56
60
**Alias**
57
61
58
62
The alias is an (optional) unique Name / identifier for the data record.
59
63
60
-
Attribute Type: alias
61
-
Column Name: alias
62
-
Name: Alias
63
-
Unique: Yes
64
-
Description: Alias of reference
65
-
Alias-Fields: Name [text]
64
+
:Attribute Type: alias
65
+
:Column Name: alias
66
+
:Name: Alias
67
+
:Unique: Yes
68
+
:Description: Alias of reference
69
+
:Alias-Fields: Name [text]
66
70
67
71
**Published**
68
72
69
-
Attribute Type: checkbox
70
-
Column Name: published
71
-
Name: Published
72
-
Published: yes
73
+
:Attribute Type: checkbox
74
+
:Column Name: published
75
+
:Name: Published
76
+
:Published: yes
73
77
74
78
**Description**
75
79
76
-
Attribute Type: longtext
77
-
Column Name: description
78
-
Name: Description
79
-
Description: Description of reference
80
+
:Attribute Type: longtext
81
+
:Column Name: description
82
+
:Name: Description
83
+
:Description: Description of reference
80
84
81
85
**Keyfacts**
82
86
83
-
Attribute Type: tabletext
84
-
Column Name: keyfacts
85
-
Name: Keyfacts
86
-
87
-
Label: Entry
88
-
Width: 500
87
+
:Attribute Type: tabletext
88
+
:Column Name: keyfacts
89
+
:Name: Keyfacts
90
+
:Label: Entry
91
+
:Width: 500
89
92
90
93
**Category**
91
94
92
-
Attribute Type: multi select
93
-
Column Name: category
94
-
Name: Category
95
-
Description: Select a category for the reference
96
-
97
-
Database table: mm_category
95
+
:Attribute Type: multi select
96
+
:Column Name: category
97
+
:Name: Category
98
+
:Description: Select a category for the reference
99
+
:Database table: mm_category
98
100
99
-
Currently, we haven’t added attributes to our mm_category MetaModel. So for the moment leave the other selects blank, we’ll get back later.
101
+
Currently, we haven’t added attributes to our ``mm_category`` MetaModel. So for the moment leave the other selects
102
+
blank, we’ll get back later.
100
103
101
104
**Highlight picture**
102
105
103
-
Attribute type: file
104
-
column name: picture_highlight
105
-
Name: Highlight picture
106
+
:Attribute type: file
107
+
:column name: picture_highlight
108
+
:Name: Highlight picture
106
109
107
110
Customize filetree (optional): select a „content“ folder where the reference pictures are stored
108
111
109
112
**Gallery**
110
113
111
-
Attribute type: file
112
-
column name: picture_gallery
113
-
Name: Gallery
114
-
115
-
Customize filetree (optional): select a „content“ folder where the reference gallery pictures are stored
116
-
117
-
multiselect: yes
114
+
:Attribute type: file
115
+
:column name: picture_gallery
116
+
:Name: Gallery
117
+
:Customize filetree (optional): select a „content“ folder where the reference gallery pictures are stored
118
+
:multiselect: yes
118
119
119
120
mm_category
120
-
^^^^^^^^^^^^^
121
+
^^^^^^^^^^^
121
122
122
-
For our categorie MetaModel we just need three attributes:
123
+
For our category MetaModel we just need four attributes:
123
124
124
125
* name (text; „name“)
125
126
* alias (alias; „alias“)
126
127
* published (checkbox; „published“)
127
128
* description (longtext; „description“)
128
129
129
-
Create the attributes as learned in the reference MetaModel.
130
+
Create the attributes as you have just learned in the reference MetaModel.
130
131
131
132
Select configuration
132
-
^^^^^^^^^^^^^^^^^^^^^^^^^^
133
+
^^^^^^^^^^^^^^^^^^^^
133
134
134
135
Early, we introduced in our „reference“ MetaModel a select attribute but leaved it’s configuration nearly blank.
135
136
136
-
The real power of MetaModel gets obvious here. With a simple select attribute you can easily connect MetaModels (or any other sql-table) and optional filter the objects. Filter? Later.
137
+
The real power of MetaModel now gets obvious here. With a simple select attribute you can easily connect MetaModels
138
+
(or any other sql-table) and optional filter the objects. Filter...? We'll talk about this later.
137
139
138
140
Edit the „multi select“ attribute in your „References“.
139
141
140
142
Choose:
141
143
142
-
* table: mm_category
143
-
* Name: name - text
144
-
* Alias: alias - alias
145
-
* Sorting: sorting
144
+
:table: mm_category
145
+
:Name: name - text
146
+
:Alias: alias - alias
147
+
:Sorting: sorting
146
148
147
149
Create Rendersettings
148
-
======================
150
+
=====================
149
151
150
-
For now, we have two MetaModel with some attributes and a link between booth. But we didn’t want just to store some data, we also like to display them.
152
+
For now, we have two MetaModel with some attributes and a link between booth. But we didn’t want just to store some
153
+
data, we also like to display them.
151
154
152
155
A render setting contains some global settings, attributes you like to display and there settings.
153
-
No matter if you like to display data in the backend or fronted you need at least one render setting. But we recommend to create at least one setting for the backend and one for the frontend.
156
+
No matter if you like to display data in the backend or fronted you need at least one render setting. But we recommend
157
+
to create at least one setting for the backend and one for the frontend.
154
158
155
159
.. note:: Prefix your render setting name with BE / FE for easy relocating*.
156
160
157
161
.. info:: It’s necessary to define one render setting as default one*
158
162
159
163
**Basic-settings**
160
164
161
-
.. note:: MetaModels provides a set of well organized, solid templates. There are templates for each render setting ( e.g. metamodel_prerendered). You can create your own templates the contao why (Backend > Templates > Create > select the template you like to overwrite > Save (maybe with a new / name addition) > Edit > Choose)
165
+
.. note:: MetaModels provides a set of well organized, solid templates. There are templates for each render setting
166
+
(e.g. metamodel_prerendered). You can create your own templates the contao why (Backend > Templates > Create >
167
+
select the template you like to overwrite > Save (maybe with a new / name addition) > Edit > Choose)
162
168
163
-
metamodel_prerendered - All attributes are rendered with there template and settings (if available)
164
-
metamodel_unrendered - All attributes are rendered in „raw“ to the frontend (the settings of the child attributes are ignored)
169
+
-metamodel_prerendered All attributes are rendered with there template and settings (if available)
170
+
-metamodel_unrendered All attributes are rendered in „raw“ to the frontend (the settings of the child attributes are
171
+
ignored)
165
172
166
173
*Output Format:*
167
-
* HTML 5 - ?
168
-
* XHTML - ?
169
-
* Text - Just the „content“
174
+
175
+
-HTML 5 Renders as HTML5 content (This is the default format in Contao and therefore suggested).
176
+
-XHTML Renders as xhtml (this format is deprecated in Contao and therefore not suggested).
177
+
-Text Renders the „content“ as plaintext.
170
178
171
179
**Jump-to-Page**
172
180
173
181
The jump-to-page comes into the game when we like to display our references as list with a detail link to one item.
174
-
So you need to define a jump-to-page where the user gets redirected if he clicks on a „detail“ link of one of our reference objects.
182
+
So you need to define a jump-to-page where the user gets redirected if he clicks on a „detail“ link of one of our
183
+
reference objects.
175
184
176
185
The filter setting define the rules for the target, your detail page.
177
186
178
187
.. info:: In list views, you need to set a filter (which includes the conditions of your detail page)
179
188
180
189
**Expert-settings**
181
190
182
-
* hide empty entries: yes
183
-
* hide labels: yes
191
+
:hide empty entries: yes
192
+
:hide labels: yes
184
193
185
194
Create a rendersetting (backend)
186
-
-------------------------------------
195
+
--------------------------------
187
196
188
197
Go to the „render settings“ of „reference“.
198
+
189
199
* Create a render setting called „BE: references“
190
200
* Add „all attributes“
191
-
* After adding, activate „name“ + „category“
201
+
* After adding, activate „name“ and „category“
192
202
193
203
.. note:: When you (later) add attributes to your MetaModel you need to add them also in your render setting.*
194
204
195
205
Create a rendersetting (frontend list)
196
206
---------------------------------------
197
207
198
208
Go to the „render settings“ of „reference“.
209
+
199
210
* Create a render setting called „FE: references list“
200
211
* Add „all attributes“
201
212
* After adding, activate „name“, „category“, „picture_highlight“
202
213
203
214
Create a rendersetting (frontend detail)
204
-
-----------------------------------------
215
+
----------------------------------------
205
216
206
217
Go to the „render settings“ of „reference“.
218
+
207
219
* Create a render setting called „FE: reference detail“
208
220
* Add „all attributes“
209
221
* After adding, activate „name“, „description“, „category“, „picture_highlight“, „picture_gallery“
210
222
211
223
Input Screens
212
-
==============
224
+
=============
213
225
214
226
For now there are two MetaModels with some Attributes and Rendersetting. But how do we get data in our MetaModels?
215
227
With input screens!
216
228
217
229
Input Screens could hold a collection of these attributes which are necessary to grep some data.
218
-
Most times you just add all attributes in one Input Screen, but with the power of different input screen you can create different edit masks for different kind of user(groups).
230
+
Most times you just add all attributes in one Input Screen, but with the power of different input screen you can create
231
+
different edit masks for different kind of user(groups).
219
232
220
233
But in our tutorial we just need one input screen for our users.
221
234
222
235
**Basic-settings**
223
-
So create a Input Screen with the following settings:
224
-
225
-
* Name: BE: Referenzen
226
-
* Standard: yes
227
-
* Panel-Layout: -
228
-
* Integration: standalone
229
-
* Backend-Section: Content
230
236
231
-
Render mode: Flat
237
+
So create a Input Screen with the following settings:
232
238
233
-
Data manipulation permission: We want to allow editing, creating and deleting items - so chosse all three.
239
+
:Name: BE: References
240
+
:Standard: yes
241
+
:Panel-Layout: -leave this empty-
242
+
:Integration: standalone
243
+
:Backend-Section: Content
244
+
:Render mode: Flat
245
+
:Data manipulation permission: We want to allow editing, creating and deleting items - so choose all three.
234
246
235
247
Select configuration
236
-
---------------------
248
+
--------------------
237
249
238
-
Okay. Now we got the empty Input Screen container with a few settings. But to get things working, we need (remember the render setting!) some attributes in it.
250
+
Okay. Now we got the empty Input Screen container with a few settings. But to get things working, we need (remember
251
+
the render setting!) some attributes in it.
239
252
240
253
Switch to the „settings“ of your currently created Input Screen and choose „add all“.
241
254
242
255
Define Attribute settings
243
256
-------------------------
244
257
245
-
Our input screen is ready. But we need tweak the attributes a little bit. For example we always want a name, description and Highlight Picture.
258
+
Our input screen is ready. But we need tweak the attributes a little bit. For example we always want a name, description
259
+
and Highlight Picture.
246
260
247
261
To get this done, we choose in these attribute settings the „mandatory“.
248
262
249
-
.. info:: Input Screens are very powerful. Take a coffee and explore the viability conditions and attribute settings.
263
+
.. info:: Input Screens are very powerful. Take a coffee and explore the visibility conditions and attribute settings.
250
264
251
265
Grouping and sorting settings
252
-
------------------------------
266
+
-----------------------------
253
267
254
268
In the grouping & sorting section you need to create at least one object to sort & maybe group your entries.
255
269
256
270
For example: "Enable manual sorting" without grouping.
257
271
258
272
View conditions
259
-
================
273
+
===============
260
274
261
-
View conditions are the easy part in MetaModels. But, you might guess that you also need here at least one to get things work.
275
+
View conditions are the easy part in MetaModels. But, you might guess that you also need here at least one to get things
276
+
work.
262
277
263
278
The view conditions define who could see and use which render setting and input screen.
264
279
265
-
.. info:: In most cases you like to show your metamodel data to all of your visitors. So you can leave the „member group“ blank.
280
+
.. info:: In most cases you like to show your metamodel data to all of your visitors. So you can leave the „member
281
+
group“ blank.
266
282
267
283
Define a view condition
268
-
------------------------
284
+
-----------------------
269
285
Define one view condition with following settings:
270
286
271
-
* member-group: -
272
-
* user-group: administrator
273
-
* input screen: BE: Referenz
274
-
* Rendersetting: BE: Referenz
287
+
:member-group: -leave this empty-
288
+
:user-group: administrator
289
+
:input screen: BE: Referenz
290
+
:Rendersetting: BE: Referenz
275
291
276
292
.. info:: Wasn’t it a good Idea to prefix our input screens and render setting? ;-)
277
293
278
294
We are ready to enter Data
279
-
-----------------------------------------
295
+
--------------------------
280
296
Some time ago, we started with just a MetaModels package and already arrived to create data. Easy, hm?
281
297
282
298
Continue to the new „Referenz“ entry in your „content“ navigation and add a first item.
0 commit comments