Experimental project

This is a sandbox project, which contains experimental code for developer use only.

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.
  }
}

Project information