There are numerous issues around behavior instantiation:
- The constructor of the behavior gets passed $field and (sometimes) $instance, but we cache the behaviors per class in _entityreference_get_behavior_handler()
- EntityReference_BehaviorHandler_Abstract::__construct() tries to load the settings from a bogus array keys, and as a consequence $this->settings is always empty
- We pass $field and $instance to the constructor, but we also pass those to every method. We should do one or the other, not both
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 1427040-instantiate-behavior.patch | 7.2 KB | damien tournoud |
| #2 | 1427040-instantiate-behavior-er-2.patch | 2.33 KB | amitaibu |
Comments
Comment #1
amitaibuI'll give it a shot.
Comment #2
amitaibu> We pass $field and $instance to the constructor, but we also pass those to every method.
Let's keep passing the $field and $instance to all the field modules methods , e.g load(), persave(), to keep the function signature consistent. To our own methods, e.g. access() - I've remove them.
Comment #3
damien tournoud commentedBecause we need to pass $field and $instance to the field methods, I would prefer to pass $field and/or $instance to every methods. Any objection?
Comment #4
damien tournoud commentedProposed patch.
Comment #5
damien tournoud commentedI actually pushed this by mistake, but I don't see how it could not work for OG (of course it is a slight API change, but the current behavior is completely broken).
Comment #6
amitaibuLooks good, thanks!