I'm just sort of brainstorming here, but bear with me while I think this out...

I'm a little worried that this module is becoming a little too specific in what it does -- for instance creating BeautyTips functionality for help links.

I'm thinking that we should have some basic API functions which other modules can easily use such as beautytips_add_js() which would simply add the script (and possibly default settings) to the page.

Another possibility is something like hook_beautytips() which could be implemented by any other module (Advanced Help for example) to define the rules for how/where its BeautyTips work. Popups module uses hook_popups() to do a similar thing and it's probably worth looking into. I'm not sure that I agree with all of the philosophies of the Popups, but it's a good starting spot for thinking about how other modules might be able to easily add BeautyTips functionality with little or no Javascript programming.

hook_beautytips() might be too much of a hassle. Another option would simply be beautytips_add_beautytips() which (unlike beautytips_add_js()) would take arguments to set up the script -- sort of a PHP port of $(element).bt(). So it might look something like:

beautytips_add_beautytips('a.advanced-help-link', array('ajaxPath' => array("$(this).attr('href')", 'div#content')));

With that method, we could leave it up to the module to decide when and on which pages to invoke BeautyTips. And it could be included in one of the module's theme functions so that a themer could override.

I could also see the BeautyTips module creating an interface to override (parts of) the jQuery.bt.defaults array. If we could package sets of these together, we would essentially have "skins" from which the administrators could choose. This would also be a way to abstract the "Which side should the popup appear on?" functionality currently in the module.

Comments

kleinmp’s picture

We were trying to think of ways to make the module easily expandable, and being able to add functionality without too much javascript programming definitely sounds like the way to go. So, it will involve some reworking of the module, but it's not too big at the moment, so now's a good time to try this out.

Alex UA posted about creating settings for changing the style of the popups here.
It sounds like creating an interface for overriding jQuery.bt.defaults array would be a good solution to that.

Anyway, these are good ideas and we will look into setting the module up in this way.

mstef’s picture

Yea this should be just like Popups API

kleinmp’s picture

This module currently has many similarities to the popups api. You can call the function beautytips_add_beautytips and pass it an array of options in order to add tooltips on any page or any place on your site. If no options are passed, then the plugin is simply loaded.

rsvelko’s picture

I am xposting this http://drupal.org/node/700710 here cause :
- the btips module is a nice API and should remain so
- but there lacks an interface for non-programmers / or interface for easier definition of btips for programmers...

pifagor’s picture

Status: Active » Closed (outdated)