New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not access ID of a FieldtypeOptions option #28
Comments
Twig has some issues calling dynamic properties using PHP's __get which is used quite a lot in ProcessWire. Try accessing it explicitly, something like |
Hello @wanze I faced the same kind of issue today. At first I thought is was a PW error, so I reported this issue. I have a Profields Table containing a Text field. If the field is empty I get an error from Twig, if the field is filled it works. I tried to follow your instructions and it works: This is strange, because it seems it doesn't happen with an Integer field. It looks like we need to use get() only in some cases, depending on the field type and if it has content. I'm afraid to get some random errors in the future if I don't use get() everywhere. |
Hi @hiboudev |
I'm using the default PW "Select Options" component and when trying to get ID of the option from a Twig, it throws an error:
Code:
{{ user.membershipStatus.id }}
The same code in PHP works fine:
$user->membershipStatus->id
The text was updated successfully, but these errors were encountered: