Needs review
Project:
Form
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Dec 2009 at 11:54 UTC
Updated:
13 Dec 2009 at 18:57 UTC
Jump to comment: Most recent file
Comments
Comment #1
sunComment #2
sunAs you can see, it is already cached.
This review is powered by Dreditor.
Comment #3
jcmarco commentedThe problem is not in this line,
what I was caching was
@@ -169,8 +170,9 @@ function form_controller_process_form(&$
);
$form_state['form_controller'] = $context;
- // @todo Cache this.
- foreach (module_invoke_all('form_controller_info') as $name => $info) {
This module_invoke_all is executed with any form in the screen because that form module form_alter,
the question is that if the first time, in the alter_form, that you get all the form_controller_info's then you can use it there as well.
It has no meaning cache once and later you have to run the same invoke in other line again (other function always call)
Comment #4
dave reidI think this is what jcmarco meant. It makes sense to convert this to using cache_set/get afterwards as well.
Comment #5
sunLet's rename this to form_info()
This review is powered by Dreditor.
Comment #6
dave reidHow about form_get_info()? Feels empty without a verb.
Comment #7
sunMy reason is http://api.drupal.org/api/function/element_info/7
Comment #8
dave reidRevised as form_info(). To be fair it's about 50% thing_get_info() and 50% thing_info() in D7 core, but I don't favor one over another.
Comment #9
sunIf we want to consider caching in a later step, then we can't embed this function_exists() into the registry.
That's quite uncommon, and I feel a bit uneasy about embedding it.
In general, we can fork 99% of the new mollom_form_get_info(), including PHPDoc and function signature.
errrr. WTF?
Why don't you use a regular foreach $form_id => $info and access the array keys properly with $form_info[$form_id]?
This review is powered by Dreditor.
Comment #10
dave reidRevised patch that:
- Uses function name form_get_info() for consistency with majority of core API info functions (and it's even mollom_get_form_info)
- Removed the function_exists() check since it doesn't make sense if its cached
- Added the PHP docs from mollom_get_form_info, but removed references to form_id (since that does not apply here)
- Modify by reference using $form_info[$key] instead of my wackiness.