-
Notifications
You must be signed in to change notification settings - Fork 40
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
Options Element settings override should check if allowed_values_function and default_value_function are set. #6654
Comments
@argiepiano I suspect you may have to set I'll try to recreate the error on a fresh site too. |
@herbdool I've been able to reproduce, but there are some caveats. IF I add BOTH:
then your PR solves the issue - no more warning. 👍🏽 IF I add ONLY:
There is no warning (before or after the PR). BUT if I add ONLY:
then the warning persists, even with the PR. 👎🏽 I think your check is not quite right. if you do this instead: $field = $form['#field'];
$instance = $form['#instance'];
if (in_array($field['type'], array('list_integer', 'list_float', 'list_text'))) {
// If the default value is set automatically skip setting the widget.
if ($instance['default_value_function']) {
return;
}
//... Then I believe the issue is solved. |
@argiepiano thanks for testing. I was wondering which was better to check. |
@herbdool there are widespread test failures. Your PR does not define In my sample code above I had: $instance = $form['#instance']; |
This is what happens when I do it on a phone. |
@herbdool sorry, but there are still a lot of failing tests. Please notice my code - you are using |
OK, reviewed and tested, LGTM. |
…tomatically. By @herbdool, @argiepiano, @klonos, and @quicksketch.
Thanks @herbdool, @argiepiano, and @klonos! I made an adjustment to the code formatting to define the |
Description of the bug
When editing a list item field widget, I get:
Steps To Reproduce
This happens if creating a list field that uses
allowed_values_function
anddefault_value_function
instead of the values set in the UI. This was originally added in #1005Expected behavior
It should either not bother to alter the form or fetch the default value from
default_value_function
.The text was updated successfully, but these errors were encountered: