Hi!
I wanted to know if it’s possible to reach a label and return it?
Example:
content_release:
label: Release Plan
type: structure
style: table
fields:
week:
label: KW
type: text
required: true
I would like to access the label KW, to add it as a tabler header for example. How would I achieve this?
You can access a blueprint via $page->blueprint()
, see also: Using blueprints in the frontend | Kirby
Thank you for the quick reply!
I tried this:
<th><?php $page->releases()->field('week') ?></th>
To get the label “KW”
But it doesn’t seem to work. This is my blueprint:
title: Releases
sections:
content:
type: fields
fields:
title:
label: Seitentitel
type: text
title_image:
label: Select header image...
type: files
required: true
name:
label: Name
type: text
required: true
menuname:
label: Menu text
type: text
required: true
content_release:
label: Release Plan
type: structure
style: table
fields:
week:
label: KW
type: text
required: true
It’s not $page->releases()
, but $page->blueprint()
, and then you can go from there, as explained in the recipe.
<?php
$field = $page->blueprint()->field('content_release');
$label = $field['fields']['week']['label'];
echo $label;