Forms API: Duplication of "#prefix" string in elements of type "weight"
Good evening, all. I'm not sure how to go about reporting this issue, but I've found that the new forms API is duplicating the value of #prefix on form elements of type "weight". It doesn't seem to happen with other types. If I change the type of the form element from "weight" to "textfield", making no other changes in the $form array, the prefix string is no longer emitted twice. So it's type-specific. I'm looking to see if I can find the cause and contribute a patch, but wanted to make the team aware of the problem. Just out of curiosity, how does one submit an issue on a core file like forms.inc? I've never done that before, but have only filed reports on contrib modules using the links from each module's project page. Sorry for my ignorance of this. Scott -- ------------------------------------------------------------------------------- Scott Courtney Drupal user name: "syscrusher" http://drupal.org/user/9184 scott at 4th dot com Drupal projects: http://drupal.org/project/user/9184 Sandbox: http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/syscrusher
On Thursday 24 November 2005 22:25, Syscrusher wrote:
Good evening, all.
I'm not sure how to go about reporting this issue, but I've found that the new forms API is duplicating the value of #prefix on form elements of type "weight". [...]
I'm looking to see if I can find the cause and contribute a patch, but wanted to make the team aware of the problem.
Bingo! The problem was that form_render() was being called from theme_weight as well as from drupal_get_form(). Each call appended the prefix and appended the suffix, so you were actually getting this: $PREFIX $PREFIX $FORM_STUFF $SUFFIX $SUFFIX I happened not to notice the extra suffix at first in the HTML output, but it was there. All that was needed was a pair of unset() calls added to theme_weight(). Under the "code is gold" premise, I've filed this as an issue (#38790) and have contributed a patch to includes/form.inc. I hope the forms API team find this helpful. Great piece of code, other than this little glitch. Scott -- ------------------------------------------------------------------------------- Scott Courtney Drupal user name: "syscrusher" http://drupal.org/user/9184 scott at 4th dot com Drupal projects: http://drupal.org/project/user/9184 Sandbox: http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/syscrusher
participants (1)
-
Syscrusher