Skip to content

Commit 6689aa4

Browse files
committed
Add example code to README.md
1 parent 38822b7 commit 6689aa4

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,28 @@ Kirby lets you use PHP-based blueprints in plugins, e.g. to use different bluepr
1414

1515
After installing this plugin, you can start using PHP-based blueprints in `site/blueprints` folder, just like you would in plugins!
1616

17-
Happy Coding!
17+
```php
18+
// site/blueprints/pages/blueprint.php
19+
20+
$user = kirby()->user();
21+
22+
$fields = [
23+
// Field config for all users
24+
];
25+
26+
if ($user->isAdmin()) {
27+
$fields = [
28+
// Admins should have a separate set of fields
29+
];
30+
}
31+
32+
return [
33+
'title' => 'PHP-based blueprint',
34+
'fields' => $fields,
35+
]
36+
```
37+
38+
> ⚠️ Any existing YAML blueprint under the same name will be overwritten.
1839
1940
[//]: # (## ⚙️ Config)
2041

0 commit comments

Comments
 (0)