How to render template {{ page.example }}
in custom section?
site/plugins/my-plugin/index.php:
...
'sections' => [
'my_section' => [
'props' => [
'headline' => function (string $headline) {
return $headline;
},
'text' => function ($text = null) {
return kirbytext($text);
},
],
],
],
...
site/plugins/my-plugin/index.js:
...
my_section: {
data: function () {
return {
headline: null,
text: null
}
},
created: function() {
this.load().then(response => {
this.headline = response.headline;
this.text = response.text;
});
},
template: `
<section>
<k-headline>{{ headline }}</k-headline>
<div v-html="text"></div>
</section>
`
},
...
Blueprint:
sections:
test:
headline: My custom section
type: my_section
text: |
Render me: {{ page.my_field }}
Me too: {{ page.date.toDate('d/m/Y') }}