0

I am using the bootstrap Tweme theme and would like to show tooltips when hovering over exposed filters (e.g. haslanguagecertificate) in a view. When hovering over profile edit fields the help text is shown properly.

I have also added the snippet in html.tpl.php before the closing < / body>.

(function($) {
   $(document).ready(function() {
   $('[data-toggle=tooltip]').tooltip();
   });
})(jQuery);

This has How to show tooltips on form labels based on view filter descriptions in a Bootstrap sub-theme? that helped, but the tooltips are not showing up. Devel does not show ['title']['#attributes'] - what do i have to write here?

/**
 * Implements hook_form_FORM_ID_alter().
*/

function customisations_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
dpm($form);
// $field_name = 'filter-title';
$field_name = 'filter-field_haslanguagecertificate_value';
$form['title']['#attributes'] = array(
  'data-toggle' => 'tooltip',
  'data-original-title' => $form['#info'][$field_name]['description']
  );
 $form['#info'][$field_name]['description'] = '';
}

enter image description here

0

form['title'] needed to be replaced with the fieldname without "filter-".

function customisations_form_views_exposed_form_alter(&$form) {
  //drupal_set_message("setting exposed filter tooltips", 'status');
  //dpm($form);
  $allFilter = array();
  $filtersList = array_keys($form['#info']);

for ($i =0; $i<count($filtersList); $i++) {
    //drupal_set_message("filter " . $filtersList[$i], 'status');
    array_push($allFilter,$filtersList[$i]);
  }

  foreach ($allFilter as $field_name) {
    $fieldTitle = substr($field_name,7); //removes the filter-  
    $form[$fieldTitle]['#attributes'] = array(
    'data-toggle' => 'tooltip',
    'data-original-title' => $form['#info'][$field_name]['description']
  );
  $form['#info'][$field_name]['description'] = '';
}
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.