I'm a bit confused as for the difference between these two hooks, and which one I should use for custom validation of attached fields in my code.
Is there a better way to define a custom validation for an attached field (I am attaching the field programatically if that helps)?
EDIT: Looking more into it, I don't really get all that much information in hook_field_attach_validate()
. All I'm pretty much getting is the entity_type, entity object and an errors array.
Whereas with hook_field_validate()
, I get the field I'm actually validating against, which, I'm assuming is where I need to put the bulk of my custom field validation logic. The only issue I'm having now is that I'm unable to find a function that will invoke this method for me. Should I manually invoke this function or is there an API function I can use in this instance?