I have a field blueprint with the filename ‘budget.yml’ in the ‘fields’ folder –
label: Budget
type: select
options:
- Less than 1 crore
- 1-2 crores
- 2-3 crores
- 3-5 crores
- 5-7 crores
- 7-10 crores
- 10-20 crores
- 20-30 crores
- 30-50 crores
- More than 50 crores
It is being used in the ‘site.yml’ file like this as I want to use the options above as input checkbox and label values –
sections:
pages:
type: pages
max: 5
other:
type: fields
fields:
budget
extends: fields/budget
type: hidden
I’m using getting those options like this –
<?php
$budgets = $site->blueprint()->field('budget');
$budget = $budgets['options'];
$bl = count($budget);
for ($bc = 0; $bc < $bl; $bc++) {
echo "<input type='checkbox' value='$budget[$bc]'>";
echo "<label> $budget[$bc]</label><br>";
}
?>
But, I get an error – ‘Trying to access array offset on value of type null’. I’m using the exact same PHP code as above to get the options from other field blueprints and they work absolutely fine. It’s only this field that is creating the problem.