Skip to content

Commit aad762f

Browse files
committed
Reformat chapter first-metamodel.
1 parent cee2c3e commit aad762f

File tree

1 file changed

+117
-101
lines changed

1 file changed

+117
-101
lines changed

manual/first-metamodel.rst

Lines changed: 117 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
---------------
21
The first MetaModel
3-
---------------
2+
-------------------
43

54
Install with composer
65
=====================
@@ -10,31 +9,36 @@ You’ll need the MetaModels core and some attributes / filter to get MetaModels
109
Don’t forget to run composer install through „Update packages“.
1110
When installed, run the database update and your MetaModels installation is done.
1211

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.
1413

1514
Your first MetaModel
16-
=====================
15+
====================
1716

1817
Create MetaModels
1918
-----------------
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.
2121

2222
In our example we need two MetaModels:
2323

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)
2628

2729
Create reference and category metamodels.
2830

2931
Create attributes
3032
-----------------
3133

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.
3336

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).
3539

3640
mm_reference
37-
^^^^^^^^^^^^^
41+
^^^^^^^^^^^^
3842
Our reference will contain these attributes:
3943

4044
* Name (text)
@@ -48,239 +52,251 @@ Our reference will contain these attributes:
4852

4953
**Name**
5054

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
5559

5660
**Alias**
5761

5862
The alias is an (optional) unique Name / identifier for the data record.
5963

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]
6670

6771
**Published**
6872

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
7377

7478
**Description**
7579

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
8084

8185
**Keyfacts**
8286

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
8992

9093
**Category**
9194

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
98100

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.
100103

101104
**Highlight picture**
102105

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
106109

107110
Customize filetree (optional): select a „content“ folder where the reference pictures are stored
108111

109112
**Gallery**
110113

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
118119

119120
mm_category
120-
^^^^^^^^^^^^^
121+
^^^^^^^^^^^
121122

122-
For our categorie MetaModel we just need three attributes:
123+
For our category MetaModel we just need four attributes:
123124

124125
* name (text; „name“)
125126
* alias (alias; „alias“)
126127
* published (checkbox; „published“)
127128
* description (longtext; „description“)
128129

129-
Create the attributes as learned in the reference MetaModel.
130+
Create the attributes as you have just learned in the reference MetaModel.
130131

131132
Select configuration
132-
^^^^^^^^^^^^^^^^^^^^^^^^^^
133+
^^^^^^^^^^^^^^^^^^^^
133134

134135
Early, we introduced in our „reference“ MetaModel a select attribute but leaved it’s configuration nearly blank.
135136

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.
137139

138140
Edit the „multi select“ attribute in your „References“.
139141

140142
Choose:
141143

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
146148

147149
Create Rendersettings
148-
======================
150+
=====================
149151

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.
151154

152155
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.
154158

155159
.. note:: Prefix your render setting name with BE / FE for easy relocating*.
156160

157161
.. info:: It’s necessary to define one render setting as default one*
158162

159163
**Basic-settings**
160164

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)
162168

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)
165172

166173
*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.
170178

171179
**Jump-to-Page**
172180

173181
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.
175184

176185
The filter setting define the rules for the target, your detail page.
177186

178187
.. info:: In list views, you need to set a filter (which includes the conditions of your detail page)
179188

180189
**Expert-settings**
181190

182-
* hide empty entries: yes
183-
* hide labels: yes
191+
:hide empty entries: yes
192+
:hide labels: yes
184193

185194
Create a rendersetting (backend)
186-
-------------------------------------
195+
--------------------------------
187196

188197
Go to the „render settings“ of „reference“.
198+
189199
* Create a render setting called „BE: references“
190200
* Add „all attributes“
191-
* After adding, activate „name“ + „category“
201+
* After adding, activate „name“ and „category“
192202

193203
.. note:: When you (later) add attributes to your MetaModel you need to add them also in your render setting.*
194204

195205
Create a rendersetting (frontend list)
196206
---------------------------------------
197207

198208
Go to the „render settings“ of „reference“.
209+
199210
* Create a render setting called „FE: references list“
200211
* Add „all attributes“
201212
* After adding, activate „name“, „category“, „picture_highlight“
202213

203214
Create a rendersetting (frontend detail)
204-
-----------------------------------------
215+
----------------------------------------
205216

206217
Go to the „render settings“ of „reference“.
218+
207219
* Create a render setting called „FE: reference detail“
208220
* Add „all attributes“
209221
* After adding, activate „name“, „description“, „category“, „picture_highlight“, „picture_gallery“
210222

211223
Input Screens
212-
==============
224+
=============
213225

214226
For now there are two MetaModels with some Attributes and Rendersetting. But how do we get data in our MetaModels?
215227
With input screens!
216228

217229
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).
219232

220233
But in our tutorial we just need one input screen for our users.
221234

222235
**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
230236

231-
Render mode: Flat
237+
So create a Input Screen with the following settings:
232238

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.
234246

235247
Select configuration
236-
---------------------
248+
--------------------
237249

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.
239252

240253
Switch to the „settings“ of your currently created Input Screen and choose „add all“.
241254

242255
Define Attribute settings
243256
-------------------------
244257

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.
246260

247261
To get this done, we choose in these attribute settings the „mandatory“.
248262

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.
250264

251265
Grouping and sorting settings
252-
------------------------------
266+
-----------------------------
253267

254268
In the grouping & sorting section you need to create at least one object to sort & maybe group your entries.
255269

256270
For example: "Enable manual sorting" without grouping.
257271

258272
View conditions
259-
================
273+
===============
260274

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.
262277

263278
The view conditions define who could see and use which render setting and input screen.
264279

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.
266282

267283
Define a view condition
268-
------------------------
284+
-----------------------
269285
Define one view condition with following settings:
270286

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
275291

276292
.. info:: Wasn’t it a good Idea to prefix our input screens and render setting? ;-)
277293

278294
We are ready to enter Data
279-
-----------------------------------------
295+
--------------------------
280296
Some time ago, we started with just a MetaModels package and already arrived to create data. Easy, hm?
281297

282298
Continue to the new „Referenz“ entry in your „content“ navigation and add a first item.
283299

284300
Filter Setting
285-
===============
301+
==============
286302
(Todo)

0 commit comments

Comments
 (0)