Over at #1526084: Abilty to add existing entities it seems to me the controller object should know what field type it's working with.
I'm wondering whether it would be possible to have something like:
$controller = inline_entity_form_get_controller($field, $instance);
However, I see places like inline_entity_form_process_entity_form() where a new controller is instantiated, where we don't seem to have the field or instance. Are they perhaps somewhere in the $form_state? Or should the controller itself be stored in the $form_state, so it doesn't have to keep getting recreated?
Comments
Comment #1
bojanz commentedI didn't want the controller to know about the $field and $instance at all (not counting the settingsForm()).
#1526084: Abilty to add existing entities has no need to place any code in the controllers, since the autocomplete behavior is per field type, not per entity type.
Comment #2
joachim commentedWhat I figured was that it would be nicer to be able to lift data from the controller than things like:
which feel a bit flaky because of the ID in there.
I've found a way to make #1526084: Abilty to add existing entities work without the controller -- as you say, it's per field type.
Comment #3
bojanz commentedCommitted:
http://drupalcode.org/project/inline_entity_form.git/commitdiff/refs/hea...
We might want to have a method fer getting the controller settings, instead of accessing $controller->settings[] directly, but that can be done in a followup.