Skip to content

Instantly share code, notes, and snippets.

@vkareh
Last active December 14, 2015 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vkareh/5005486 to your computer and use it in GitHub Desktop.
Save vkareh/5005486 to your computer and use it in GitHub Desktop.
<?php
/**
* Implements hook_form_FORM_ID_alter() for views_exposed_form.
*/
function MODULE_form_views_exposed_form_alter(&$form, &$form_state) {
$form['#after_build'] = array('_MODULE_apply_js');
}
function _MODULE_apply_js($form, &$form_state) {
drupal_add_js(drupal_get_path('theme', 'wsup') . '/scripts/script.js');
return $form;
}
(function ($) {
Drupal.behaviors.wsupStyleFilters = {
attach: function (context, settings) {
console.log('JS Loaded!');
$('input[type=checkbox]:checked').next('label').addClass('selected');
$(".views-exposed-form select").styleSelect();
$(".views-exposed-form select").change(function() {
console.log('Filter Changed!');
// $(this).parents("form").submit();
}
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment