- Issue created by @Dave Kopecek
I'm getting the following error when trying to modify field values on a view containing product variation types:
Error: Call to undefined method Drupal\views_bulk_operations\Form\ConfigureAction::getEntity() in Drupal\commerce_bulk\Plugin\Field\FieldWidget\BulkSkuWidget->formElement() (line 149 of modules/contrib/commerce_bulk/src/Plugin/Field/FieldWidget/BulkSkuWidget.php).
Create a view of product variation types, configure VBO to modify field values, then try modifying a field value
The error occurs because the code assumes that the form object will always have a getEntity() method, but in this case, it's being called from a Views Bulk Operations (VBO) context where the form object is ConfigureAction which doesn't have this method.
The issue is that the code directly calls getEntity() on the form object without checking if the method exists. When using Views Bulk Operations, the form object is different and doesn't have this method.
The fix adds a check using method_exists() to ensure the form object has the getEntity() method before trying to use it. This will prevent the error when the widget is used in contexts where the form object doesn't support entity operations.
Patch to follow.
Active
2.0
Code