When you have a BREAD row using the Select Dropdown type, it give problems handling the options when a option is removed.
Make BREAD with a Select Dropdown row and the following settings:
{
"default": "Foo",
"options": {
"foo": "Foo",
"bar": "Bar"
}
}
Then create a new row with this set as Foo.
Then edit the BREAD settings to:
{
"default": "Bar",
"options": {
"bar": "Bar"
}
}
Then go back to the row for that BREAD and it will throw the following error:
ErrorException in 1dc0155360549e4cd7aacdfed574eebe6a05f97e.php line 68:
Undefined property: stdClass::$foo (View: /site.dev/vendor/tcg/voyager/resources/views/bread/browse.blade.php)
My idea for a solution is to show the default option if the option no longer exists.
This happens also when adding more options. It doesn't update correctly in database. If you delete the data entry from data_rows table even if it seems updated and save your bread again it works great. Don't know why yet
Can someone confirm that this already fixed in 1.0 ?
@handiwijoyo it's not fixed so far.
Duplicating my comment from #1639 in case it helps:
For me this error was solved with the exclusion of a null value on the obj:-
/vendor/tcg/voyager/resources/views/bread/browse.blade.php
Line 118
@unless(empty($options->options->{$data->{$row->field}}))
{!! $options->options->{$data->{$row->field}} !!}
@endunless
*Edit: Let me know if it solves for you and I will submit PR *
Yes that indeed works.
Alternatively we could use {!! $options->options->{$data->{$row->field}} or '' !!}
@dhonions Do you want to submit a PR for this?
@emptynick Yes, please do.
@dhonions Superb work! Issue fixed. PR!
Hi, for me this error was solved with
{!! $options->options->{$data->{$row->field}} or $data->{$row->field} !!}

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Most helpful comment
Duplicating my comment from #1639 in case it helps:
For me this error was solved with the exclusion of a null value on the obj:-
*Edit: Let me know if it solves for you and I will submit PR *