Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
theme_form is being overridden because we wanted the text popups to show up on every single form, so the javascript is being added on the override of theme_form. This can usually be done through theming, but since this is a module we had to do it differently. In the future we may want to have the types of forms that the popups show up on to be configurable, but for now we're keeping it simple.
theme_textfield is being overridden, because the the beautytips was using the 'title' in the text fields to display the text of the popups, but the text we wanted to be displayed was in the description. So, the override simply takes the description of the text-field and places it into the 'title' of the text box.
If you have any ideas on how to better implement this, then we're happy to try them out.
Well off the cuff, you could eliminate the need for retheming the textareas by doing something like this (untested):
$('textarea.form-textarea').each(function(){
var description = $(this).parents('.form-item').find('div.description').hide().html();
$(this).bt(description);
});
That *should* find the description which is a sibling (it's actually more like an uncle) of of the textarea, hide the description saving its content into the description variable, and then create a BeautyTip for the textarea using the content (inner html) of the description.
I also removed the theme_form override and now there's a form alter instead. I'm thinking that this may allow some more customization for future development of this project.
Comments
Comment #1
kleinmp commentedtheme_form is being overridden because we wanted the text popups to show up on every single form, so the javascript is being added on the override of theme_form. This can usually be done through theming, but since this is a module we had to do it differently. In the future we may want to have the types of forms that the popups show up on to be configurable, but for now we're keeping it simple.
theme_textfield is being overridden, because the the beautytips was using the 'title' in the text fields to display the text of the popups, but the text we wanted to be displayed was in the description. So, the override simply takes the description of the text-field and places it into the 'title' of the text box.
If you have any ideas on how to better implement this, then we're happy to try them out.
Thanks!
Comment #2
jjeff commentedWell off the cuff, you could eliminate the need for retheming the textareas by doing something like this (untested):
That *should* find the description which is a sibling (it's actually more like an uncle) of of the textarea, hide the description saving its content into the description variable, and then create a BeautyTip for the textarea using the content (inner html) of the description.
This is sort of similar to what I'm doing for the thumbnail images on the Do It With Drupal videos page: http://www.doitwithdrupal.com/schedule/videos
Comment #3
kleinmp commentedAwesome! This method worked nicely and I got rid of the theme_textfield override.
Comment #4
jjeff commentedGreat!
{closing issue}
Comment #5
jjeff commentedComment #6
kleinmp commentedI also removed the theme_form override and now there's a form alter instead. I'm thinking that this may allow some more customization for future development of this project.