Problem/Motivation
The ListInteger and Boolean fwa plugins are broken. I’m assuming others e.g. ListFloat are also broken. Something has changed in 1.2.x-dev around July 21st, maybe AutomatorBaseAction?
Sample error looks like this:
Error: Call to a member function get() on array in Drupal\ai_automators\Plugin\FieldWidgetAction\Boolean->saveFormValues() (line 49 of /var/www/html/web/modules/contrib/ai/modules/ai_automators/src/Plugin/FieldWidgetAction/Boolean.php)
Steps to reproduce (required for bugs, but not feature requests)
- Enable AI Automator on a boolean field;
- Choose AI Automator Type » LLM Boolean;
- Configure AI Automator Settings;
- Go to e.g. admin/structure/types/manage/page/form-display
- Configure FWA on boolean field
- Edit a Page node and click on the fwa button
Issue fork ai-3538762
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
anjaliprasannan commentedComment #4
anjaliprasannan commentedComment #5
bisonbleu commentedThanks for this @anjaliprasannan. That said, your fix is at the plugin level, not upstream which is where, I think, @Marcus_Johansson was alluding to when he wrote «I know where this comes from» in Slack. The issue description also mentions that this affects other plugins e.g. ListFloat, etc.
Perhaps @Marcus_Johansson can provide more details about what he meant by «I know where this comes from»…?
Comment #6
anjaliprasannan commented@bisonbleu
I am trying to improve the saveFormValues() in AutomatorBaseAction like,
the method now correctly handles both array and object field items. This means that most plugin-level overrides of saveFormValues() are no longer necessary unless they add widget-specific logic.
I recommend removing the redundant saveFormValues() methods from individual FieldWidgetAction plugins and letting them inherit the base implementation. If that is allowed I can move further.
Thanks
Comment #7
marcus_johansson commentedComment #8
marcus_johansson commentedComment #9
marcus_johansson commentedLooks good and works well.
Comment #14
fagoRe-checked ci-pipeline, all good now, thus merged.