Please consider making description length limit of 200 characters configurable. Currently it is hardcoded and to change that in a subtheme the whole bootstrap_form_element function has to be copy pasted into subtheme just to change this one value to allow longer tooltips.
It's just a small change to the configuration form (theme/settings.inc):
// Added to allow auto tooltips for longer descriptions
$form['javascript']['tooltips']['bootstrap_tooltip_descriptions_length'] = array(
'#type' => 'textfield',
'#title' => t('Simple form description length limit'),
'#description' => t('Form items that contain simple descriptions (no HTML) will be converted into tooltips if description length is smaller than this value.'),
'#default_value' => theme_get_setting('bootstrap_tooltip_descriptions_length'),
'#states' => array(
'visible' => array(
':input[name="bootstrap_tooltip_enabled"]' => array('checked' => TRUE),
),
),
);
and to the bootstrap_form_element function (theme/system/form-element.func.php):
// Convert some descriptions to tooltips.
// @see bootstrap_tooltip_descriptions setting in _bootstrap_settings_form()
if (!empty($element['#description'])) {
$description = $element['#description'];
if (theme_get_setting('bootstrap_tooltip_enabled') && theme_get_setting('bootstrap_tooltip_descriptions') && $description === strip_tags($description) && strlen($description) <= theme_get_setting('bootstrap_tooltip_descriptions_length')) {
$tooltip = TRUE;
$attributes['data-toggle'] = 'tooltip';
$attributes['title'] = $description;
}
}
I can prepare a patch if you want but please let me know if you are interested in implementing this at all. The hardcoded value is real PITA here.
Comments
Comment #2
markhalliwellComment #5
markhalliwellI'm just moving this back to 7.x. If this needs re-evaluation in 8.x, create a new issue.
Comment #6
shiraz dindarAgreed this is a bit of a pain as the only way to override the 200 char limit is to patch bootstrap directly in bootstrap_form_element (as this is not overridable -- see https://www.drupal.org/node/1991102).
There's also a limitation here that long text fields do not yet have their description available to $element in theme_form_element, so they do not get the tooltip even if the other conditions are met.
Here's a patch I did for myself to address both these issues.
Mark, if you're interested to roll this (perhaps with a variable for the max char limit, or perhaps excluding the long text change -- which also requires some CSS to hide the non-tooltip description), lmk and I will alter to make it suitable for contribution.
Comment #7
markhalliwellI already committed a fix in #1.
Comment #8
shiraz dindarOh sorry I missed that... just now noticing the big gap in release dates for the dev and stable releases. Is a stable release due anytime soon? Just deciding whether to switch to dev or wait.
Comment #9
markhalliwellTry upgrading to beta2 first, I'm looking for people to test upgradability. Make sure to read the release notes. If you encounter any issue, please create a new issue.