Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Several modules display the description of a term on the term view page. Because of this it's nice to be able to edit term descriptions with a WYSIWYG interface (such as TinyMCE). Would this be hard to achieve in TM?
Comment | File | Size | Author |
---|---|---|---|
#13 | x_term_description.zip | 1.19 KB | JCB |
Comments
Comment #1
Ne_L@drupal.ru CreditAttribution: Ne_L@drupal.ru commentedor simple BUEditor integration - this is very need. Please.
Comment #2
temp CreditAttribution: temp commentedYes - this is very usefull option!
Comment #3
temp CreditAttribution: temp commentednow BUEditor can't appear in 'description' form
Comment #4
belpix CreditAttribution: belpix commentedit would be great if someone implement this in Wysiwyg module, or just tell the hack
Comment #5
temp CreditAttribution: temp commentedFCKeditor witch enabled popup window - is good solution!
Comment #6
klonossubscribing...
Comment #7
JayNL CreditAttribution: JayNL commentedThis is the first time I'm saying this, and no matter how I hate such replies... here I am: Subscribing!
//EDIT
Oh that was easy... Just 1 line of extra code in taxonomy.admin.inc and here we are... It works!
http://drupal.org/node/358316 and especially this comment solved my problem. Now there's a nice WYSIWYG editor to edit my taxonomy term descriptions. Very nice!
Comment #8
Fenwick CreditAttribution: Fenwick commentedWould you care to share what that one line of extra code is and exactly where you put it? The thread you linked to still isn't clear to me.
Comment #9
JayNL CreditAttribution: JayNL commentedsure Fenwick, here goes. Be aware that this way actually sucks, because on a next update of the taxonomy.admin.inc, your line of code would be gone...
Look at the comment I linked to: http://drupal.org/node/358316#comment-2028306
Open up taxonomy.admin.inc and find this code:
Replace it with this:
and done :)
Comment #10
m.stentaI'm not sure where you're seeing that code, JayNL... it doesn't appear anywhere in the core Taxonomy module, or in the Taxonomy Manager module. And even if it did, I don't see how the 1 line that was added worked, because it uses the $node variable, which isn't available in the context of the term edit form. It looks like you copied it directly from the comment you cited (http://drupal.org/node/358316#comment-2028306), which makes no reference to the Taxonomy module at all. It appears to be someone's custom code, or code for applying WYSIWYG filters to a node edit form. I don't mean to call you out on what you wrote, I just found your comment to lead me into more confusion. Please only post solutions if you've tested them, otherwise don't claim them to be solutions. That said, your comment did point me in the direction of the real solution...
There is a clean and easy way to enable WYSIWYG support for term descriptions via a very small custom module. All it requires is a form_alter that adds the same one line to the form (with some modification to make it work in this context). No need to edit any core code...
It uses the same function, filter_form(), applied to the 'identification' fieldset (that's created by the taxonomy module). Notice that I used "2" as the only argument. This is specific to my implementation, and should be changed based on what input filter you're using on your site. Since I'm the only one editing terms on my site, I used filter format 2, which is the Full HTML filter on my setup. If you leave it blank, the default filter format will be used.
Hope that helps someone, and maybe it can be integrated into Taxonomy Manager as well.
Comment #11
JayNL CreditAttribution: JayNL commentedI was actually hoping somebody would come up with a nicer solution, so thanks a lot mstenta for your help!!
Comment #12
m.stentaUpon further testing, it seems that this only partially works. The term description is passed through xss_filter_admin() before being displayed, which is a very lenient filter, but does not allow 'object' or 'embed' tags, so it won't work for everything.
The following tags will work (taken from http://api.drupal.org/api/function/filter_xss_admin):
'a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'ins', 'kbd', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'
Comment #13
JCB CreditAttribution: JCB commentedThanks mstenta,
I used your code and created a module for you guys.
This is my first module ever; so bare with me.
Take note that you will have to enable WYSIWYG as well as enable a editor.
Make sure you can get the wysiwyg interface for editing nodes - you should then see the wysiwyg interface on the term edit pages
JCB
Comment #14
mikeefreedom CreditAttribution: mikeefreedom commented@JCB
Works like a dream mate!!
Thanks JCB and mstenta.
Comment #15
drupalmess CreditAttribution: drupalmess commentedHmmm... not doing it for me. Using the x_term_description module above, and changing the filter_form() function to use my default settings, I get the expected 'Input format' field added to the Introduction fieldset with the correct default setting, but the description field remains a non-wysiwyg resizable textarea, and I get the following error in a javascript alert:
Error: The TEXTAREA with id or name set to "" was not found
What am I missing?
Comment #16
NaX CreditAttribution: NaX commentedTo get around the the filter_xss_admin issue you can override it in your theme.
Something like. (take note of 'mytheme_' and '$MYFORMAT')
Comment #17
michalczernik CreditAttribution: michalczernik commented@JCB:
Thank you!
However for me this module enables the choice of input formats, and even if I choose FullHTML [this one should use WYSIWYG editor, and it does elsewhere] no WYSIWYG shows up.
Any ideas?!
Comment #18
JCB CreditAttribution: JCB commentedLoutka,
In response to your query... I found that what the custom module does is enable a wysiwyg editor on the second field available on the page.
I know that some modules add additional fields above the term description field; an example of this is automatic title.
In the module's code you should be able to change the field number by modifying the number located here:
$form['identification']['format'] = filter_form(2);
-- change the filter_form(2) to filter_form(3) (just an example)
Hope this helps
Comment #19
mattgilbert CreditAttribution: mattgilbert commentedsubscribe
Comment #20
CMStom CreditAttribution: CMStom commented@m.stenta,
your solution worked for me! awesome!
Comment #21
dieppon CreditAttribution: dieppon commentedHave you tried wysiwyg extra?
It adds wysiwyg support to taxonomy descriptions
Comment #22
ivnish CreditAttribution: ivnish commented