Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm trying to implement "Modify entity values" to update a field value. I'm running into a road block when images are required in the content type. Instead of updating the node, I'm getting an error that the image field is required. I went into my content type and unchecked require field and the action performs as it should.
It appears that this has been addressed here http://drupal.org/node/1057158#comment-5487060, so I'm not sure why this isn't working.
Comments
Comment #1
timnash CreditAttribution: timnash commentedI'm having the exact same issue here. Image field is required, and I'm trying to update a different field in the same content type. I get "Image field is required." warning message.
Comment #2
timnash CreditAttribution: timnash commentedOK, Here's the fix for this. Sorry, don't have time to make up a patch.
At line 200 in actions/modify.action.inc, there is a piece of code that sets #access = false then a piece of code that unsets required on all fields. Just swap these around (so it unsets required first) and then it will work fine.
Comment #3
bojanz CreditAttribution: bojanz commentedHm, that's odd, I don't see why the solution in #2 should make a difference (you end up with the same $form structure either way).
EDIT: Sorry, was tired when I wrote this, ignored the "continue" in code. I'll post a patch.
Comment #4
bojanz CreditAttribution: bojanz commentedCommitted a fix.
Comment #5
cjacobsen CreditAttribution: cjacobsen commentedThanks for the patch! I installed the latest dev release and it's working.
Comment #7
nicholasThompsonDev works for me too.
Comment #8
dhalbert CreditAttribution: dhalbert commentedI am seeing this problem for a Date field, even with the latest VBO dev which has the fix mentioned above.
I am trying to modify just the Body field of a node that also has a Date field and I'm getting an error: "A valid date is required for Event Date/Time Start date." The field (named "Event Date/Time") is required and has a non-required End date.
There are other fields in the node content type that are not Dates, are required, and don't cause this problem.
If I choose both the Date field and the body and give them values, the modification proceeds just fine. Or if I make the Date field not required, that also works, as I'd expect.
So I think this problem may be peculiar to Date fields, but I'm not sure whether it's a bug in Date or an idiosyncrasy of Date with respect to VBO that VBO should handle. I haven't submitted a bug report to Date yet. Enlightenment welcomed.
Comment #9
AaronBaumanBojanz: can you share the fix from #4 and I can try to come up with a patch for date fields, or figure out if this is actually an issue for Date module?
Comment #10
bojanz CreditAttribution: bojanz commentedhttp://drupalcode.org/project/views_bulk_operations.git/commitdiff/0b1bfcf
The original issue was fixed, so I'm reclosing this.
If you have additional fixes specific for Date, open a new issue.