Closed (fixed)
Project:
Drupal core
Version:
x.y.z
Component:
base system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Nov 2005 at 18:17 UTC
Updated:
26 Nov 2005 at 16:28 UTC
hook_textarea is broken, legacy.inc code had: http://drupaldocs.org/api/head/function/form_textarea ... it invokes modules that use the hook_textarea such as TinyMCE or HTMLArea.
This patch adds that back in.
However, after talking with webchick on IRC maybe this hook is no longer needed because of #pre and #post? Docs aren't clear if this is the case, please advise and/or apply patch, thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| form.inc_2.patch | 1.68 KB | m3avrck |
Comments
Comment #1
walkah commented+1 for including this, as it makes one less thing the contrib authors would have to update. :P
Comment #2
webchickI should clarify, not #pre and #post, but #prefix and #suffix, which would allow appending of markup before and after a form element. These are documented here:
http://drupaldocs.org/api/head/file/contributions/docs/developer/topics/...
http://drupaldocs.org/api/head/file/contributions/docs/developer/topics/...
However, I'm not 100% clear on what hook_textarea actually does so I may be mistaken. :)
Comment #3
Thox commentedThe currently forms API alternative would be to use hook_form_alter and change all append the pre and post code to all textareas. Simply bringing back hook_textarea seems a lot easier.
The main purpose is for WYSIWYG controls, but I also use it for adding a spellcheck to all textareas (although I've worked around that).
Comment #4
m3avrck commentedYes I agree, right now it seems in alter_form() you have to loop through all form elements to find the textareas, and then set #suffix (or #prefix) as necessary. Seem that my above patch would really simplify this.
Thoughts on best route to take?
Comment #5
m3avrck commentedWithout this patch, each hook_textarea would have to be renamed and use the following code:
So either the patch above or every hook_textarea() turns into above, that seems to be all I can dig up :)
Comment #6
m3avrck commentedJust to further comment, if we used the proposed patch, it is only a one line changed to upgrade TinyMCE so it works.
If we don't, upgrading TinyMCE will require the above code, plus some other tweaks here and there.
My vote would be to add the patch so that the hook still works. form_alter() is very powerful and useful, but in the case of hook_textarea (which was meant specifically for WYSIWYGs) it seems best to leave that.
Comment #7
dries commentedI'd rather not introduce hooks for the sake of introducing hooks. It's better to have one way of doing things, rather than 3 ways of doing things. The form API has a generic mechanism to alter forms; let's use that rather than re-introducing special case code.
Comment #8
m3avrck commentedDries I see your point and I guess we'll all just have to do a little more work to update our modules then :-p
Comment #9
Wesley Tanaka commentedI'm about to install this patch on my site for now until the TinyMCE in CVS is updated for the new API. What's the one line change to TinyMCE, or has it already been checked into CVS?
Comment #10
m3avrck commentedTinyMCE has been updated and is waiting for this patch to be committed: http://drupal.org/node/38038 ... after that TinyMCE will work and I'll be going through cleaning up any remaining bugs.
Comment #11
scroogie commentedI thought with your proposed changes in #5 the patch would not be needed?
Comment #12
Wesley Tanaka commentedI think something analagous to the changes in #5 just got committed: http://drupal.org/cvs?commit=21743
Comment #13
scroogie commentedI dont think so, there is no _form_alter() function defined in the applied patch.
Comment #14
m3avrck commentedOh no, the patch changed again :-) The new patch uses hook_elements() instead, it is the preferred way and there is one last pending patch that fixes this approach when dealing with #prefix and #suffix when using #process. Sorry for the confusion!