[ ]
true – check –
[✔]
This is a very simple application of the struct plugin. The goal should be to add a fact box to each page in a namespace.
Prerequisites:
As mentioned in the forum, this example is actually too simple to use struct effectively.
We will create a simple struct schema, called fact
.
Go to the admin page and follow the link “Struct Schema Editor”.
Under “Create new Schema” we enter the name of the new schema at “Schema Name:”, in this case fact
.
We create 11 simple Fields:
Fields (Configuration - only not default is mentioned): Select first the Type of the field. Click “Save” after each Field, you get a new sort-number and a new row.
Schema: fact |
|||||
---|---|---|---|---|---|
Sort | Field Name | Multi-Input?1) | Configuration | Type | Enabled |
10 | name | false | label: Name | Text | true |
20 | original name | false | label: Original Name | Text | true |
30 | real name | false | label: Real Name | Text | true |
40 | synonyms | false | label: Synonyms | Text | true |
50 | image | false | label: Image, width: 120 | Media | true |
60 | day of birth | false | label: Day of birth, pastonly: true | Date | true |
70 | day of death | false | label: Day of death, pastonly: true | Date | true |
80 | category | true | label: Category, Values: “none,Person,Technology,Hobby” | Dropdown | true |
90 | dimensions | false | label: Dimensions | Text | true |
100 | formula | false | label: Formula | Text | true |
110 | relations | true | label: Relations, usetitles: true | Page | true |
Click the “Save” button after each new entry.
Why do we have so many fields for the names? struct will always display only the fields that are filled. Suppose we want to describe a movie with a factbox:
Similar for an actor:
There are no required fields, but I would always fill the Category field.
Now it's time to make sure that the fact box is available on all pages of a namespace.
Go to the admin page and follow the link “Struct Schema Assignments”.
On the page “Schema Assignments”:
fact
Click the “Add” Button.
For the namespace myns
we have connected the schema fact
for all pages (first *) and all subnamespaces (second *) and their pages.
The Factbox can be filled out on every page in myns
.
To create the page, insert text in the editor. Otherwise the page and the data in struct fields will not be saved!
Thats all
[ ]
[✔]