Needs work
Project:
Sexy Exposed
Version:
6.x-1.0-alpha1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Feb 2010 at 08:22 UTC
Updated:
9 Dec 2010 at 19:44 UTC
Will the module has an integrations with Taxonomy, Content Taxonomy modules ?
Comments
Comment #1
zserno commentedThis module was made for a specific need: to enhance multiple select lists on a views exposed form using the drop down select list jquery plugin.
However I like your integration idea. I can imagine this as sub-modules that integrate with other modules.
Unfortunately I can't promise any exact date, since I'll do it in my free time. Of course donations and/or patches are more than welcome. :)
Marking this as a feature request.
Comment #2
aboros commentedthe name declares the purpose, it is ment to work with exposed filters.
however, i can easily envision a "form widget suite" shaped from already existing really useful jquery widgets, allowing the administrator to set them to replace 'old school' form elements. this module is the proof of concept of such a suite, in my mind. :)
Comment #3
locomo commented+1 subscribe
Comment #4
Dr. Evil commentedHello all,
I like this module so much because of its easy handling. Now I had the need of using Sexy Exposed Select Boxes insead of default select boxes in node-forms. It took a while, but finally I got it working.
For anybody who has a need of it:
Here are the lines of code that I added at the end of the sexy_exposed.module file.
/**
* Implementation of hook_menu().
* Administration link
*/
function sexy_exposed_menu() {
$items = array();
$items['admin/settings/sexy_select_boxes'] = array(
'title' => t('Sexy Select Boxes'),
'description' => t('Use Sexy Select Boxes in Node Forms.'),
'page callback' => 'drupal_get_form',
'page arguments' => array('sexy_exposed_admin_settings'),
'access arguments' => array('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
/**
* Build settings form().
* Administration Form to set Sexy Exposed Forms enabled or disabled
*/
function sexy_exposed_admin_settings() {
$form['sexy_node_forms_general'] = array(
'#type' => 'fieldset',
'#title' => t('Options'),
);
$form['sexy_node_forms_general']['use_sexy_select_boxes'] = array(
'#type' => 'checkbox',
'#title' => t('Use sexy Select boxes in Node Forms'),
'#description' => t('Use the sexy Select box instead of the default Select box in all Node Forms.'),
'#default_value' => variable_get('use_sexy_select_boxes', FALSE),
);
return system_settings_form($form);
}
/**
* Implementation of hook_form_alter().
*/
function sexy_exposed_form_alter(&$form, $form_state, $form_id) {
// if sexy exposed is enabled in admin settings,
// then add a function to the after-build-process of the current form
if(variable_get('use_sexy_select_boxes', FALSE) == TRUE) {
$form['#after_build'] = array('sexy_node_forms_process');
}
return form;
}
/**
* Form process callback; translates multiselect fields into Sexy Select Boxes.
*/
function sexy_node_forms_process($form, $form_state, $complete_form = NULL) {
if($form['#id'] == 'node-form') {
/*
* handling to make sexy CCK select boxes within node-forms
*/
foreach($form as $element) {
if(is_array($element)) {
// if ['value']['#type'] isset, then we have a field
if(isset($element['value']['#type'])) {
// if the field is from type 'select' and sexy select boxes is enabled for all multiple select boxes, then use sexy exposed select box
if(($element['value']['#type'] == 'select') && isset($element['value']['#multiple']) && $element['value']['#multiple'] == TRUE) {
$needs_sexy_love[] = 'select#'.$element['#id'].'-value';
}
}
elseif($element['#type'] == 'fieldset') {
// if we have an fieldset, then we have to check each single field of the fieldset
foreach($element as $field) {
if(isset($field['value']['#type'])) {
// if the field is from type 'select' and sexy select boxes is enabled for all multiple select boxes, then use sexy exposed select box
if(($field['value']['#type'] == 'select') && isset($field['value']['#multiple']) && $field['value']['#multiple'] == TRUE) {
$needs_sexy_love[] = 'select#'.$field['#id'].'-value';
}
}
}
}
}
}
/**
* handling to make sexy taxonomy select boxes within node-forms
*/
// get vocabularies for current node-type
$vocabularies = taxonomy_get_vocabularies($form['type']['#value']);
if(is_array($vocabularies)) {
foreach($vocabularies as $vocabulary) {
if(isset($form['taxonomy'][$vocabulary->vid]['#type'])) {
if($form['taxonomy'][$vocabulary->vid]['#type'] == 'select' && $form['taxonomy'][$vocabulary->vid]['#multiple'] == TRUE) {
$needs_sexy_love[] = 'select#'.$form['taxonomy'][$vocabulary->vid]['#id'];
}
}
}
}
/**
* make all found select boxes sexy
*/
if (!empty($needs_sexy_love)) {
$path = drupal_get_path('module', 'sexy_exposed');
// Add necessary js files.
jquery_ui_add('ui.core');
drupal_add_js($path .'/js/ddcl/js/ui.dropdownchecklist-min.js');
drupal_add_js($path .'/js/sexy_exposed.js');
drupal_add_js(array('sexyExposed' => $needs_sexy_love),'setting');
// Add necessary css files.
drupal_add_css($path .'/js/ddcl/css/ui.dropdownchecklist.css');
}
}
return $form;
}
/*
Best regards,
drevil
*/
Comment #5
Andrew Gorokhovets commentedsubscribing
Comment #6
Grayside commentedThat's not a patch. That's a pasted code too ill-formatted to easily read. It also does not follow the module maintainers request that such work be confined to a submodule or a separate project.
Understandable that this module is dedicated to exposed filters, but a consistent ui experience requires all multi-selects the chance to opt-in to the same enhancement.
Personally I would like to see modules/sexy_other or even a simple hook-based system to opt in more forms. I don't need exposed filters enhanced so much as I need javascript integration functionality that can do exposed filters, and everything else.