If the select options looks like that
1: Label
2: Label2
3: Label3
I get “Label” with
$page->select_name()
But how to get the 1 before the Label?
$page->select_name()->???()
If the select options looks like that
1: Label
2: Label2
3: Label3
I get “Label” with
$page->select_name()
But how to get the 1 before the Label?
$page->select_name()->???()
Short: In this case you can’t get them.
Long:
Normally, your keys are stored in the content file, not the labels. So $page->select_name()
would automatically return the desired value. The problem here are the numeric keys. To use them, you have to set your options in the long form:
fields:
category:
label: Category
type: select
options:
- value: '1'
text: Label 1
- value: '2'
text: Label 2