Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
field system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
25 Jan 2009 at 17:08 UTC
Updated:
5 Jun 2009 at 17:03 UTC
Field API defines that a functionality that is not needed on every page load, so we'd like to use the code registry to auto-load it. This means we have to require every module that wants to use Field API functions to wrap their calls in drupal_function_exists(), which is ugly, use module_invoke(), which makes pass-by-reference impossible, or by providing autoloaders. I've written a script that generates auto-loaders and works great, except that the code registry isn't available during installation.
I'm not sure what the right solution is.
Comments
Comment #1
damien tournoud commentedOne way of doing this could be #332733: Implement a way to require that some functions are available.
Comment #2
bjaspan commentedAs I also mentioned in #332733: Implement a way to require that some functions are available, I changed the auto-loaders generated by my script not to require the code registry, so they now work during installation. I believe this is the best solution given the options available. There are still some minor improvements to make but the approach will remain the same.
The only question now is which Field API functions should be autoloaded and which should always be loaded. My opinion is that Field Attach API is the most often used (e.g. for every node/user/object page view). If we are auto-loading those functions, I think we should auto-load Field CRUD API too, which is the only other Field API function set currently being always-loaded.
Comment #3
bjaspan commentedThis issue was taken over by #445044: Try to remove the field autoload "feature".