Form API JS Plugins
Categories
Component ID
1525732
Component name
Form API JS Plugins
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
FAPI JS Plugins is an API module that applies declared JS plugins to Form API Elements. This sandbox project offers the Chosen jQuery plugin as an example implementation. To use it, write a hook_form_alter:
function mymodule_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'choose_your_destiny') {
// Chosen only supports 'select' element types — this is declared in
// chosen_fapijs_info().
$form['destiny']['#fapijs']['chosen'] = 'chosen';
// Anything that evaluates to TRUE should be enough.
// TODO: if an array is passed, merge it with plugin options.
}
}
