Closed (fixed)
Project:
Inline Entity Form
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 Jul 2012 at 05:23 UTC
Updated:
31 Jul 2015 at 20:48 UTC
Jump to comment: Most recent
Comments
Comment #1
fulat2k commentedKinda got this working. But it doesn't highlight a specific form element. Still figuring that out :(
Comment #2
bojanz commentedSomething like #1 is the right way to do it.
Instead of the generic form alter, I would use hook_inline_entity_form_entity_form_alter() that is documented in inline_entity_form.api.php
Comment #3
jonloh commentedYes, after looking up and down, hook_inline_entity_form_entity_form_alter() is the right way to go. Thanks bojanz!
Comment #4
mrharolda commentedIs it possible to add a validator to the inline entity(/node) form instead of a single field? The inline documentation states "The entity form is first validated by its controller." but I can't seem to be able to extend/hook into that?
Comment #5
bojanz commentedJust add an #element_validate to the complete $entity_form that hook_inline_entity_form_entity_form_alter() gives you.
That key can be on any level of the form.
That's how IEF does it for itself as well.
Comment #6
mrharolda commented@bojanz: Confirmed! tnx!
Too bad the form values are tucked away like this:
A reference to it makes it a bit more readable:
Comment #7
bojanz commentedActually:
gives you the relevant values for that $entity_form.
Comment #9
aaronbaumanThis method only works if the IEF "save" button is used.
The element validation doesn't fire if the parent form is saved before submitting the IEF.
Is there a method that works for both, rather than having to implement two separate validations?
Comment #10
aaronbaumansorry, i'm mistaken.
#element_validate should be sufficient.