You are here

function acquia_lift_chosenify_element in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift.ui.inc \acquia_lift_chosenify_element()

Attaches the jQuery "chosen" behavior to the the passed in element.

Parameters

array $element: An array representing a multi-select form element.

array $classes: An array of classes to be included on this element.

3 calls to acquia_lift_chosenify_element()
acquia_lift_form_personalize_admin_form_alter in ./acquia_lift.module
Implements hook_form_FORM_ID_alter().
acquia_lift_form_personalize_agent_form_alter in ./acquia_lift.module
Implements hook_form_FORM_ID_alter().
acquia_lift_report_custom in ./acquia_lift.admin.inc
Form build function for a custom Acquia Lift agent report.

File

./acquia_lift.ui.inc, line 107
acquia_lift.ui.inc Provides functions needed for the front-end UI.

Code

function acquia_lift_chosenify_element(&$element, $classes = array()) {
  $chosen_path = libraries_get_path('chosen');
  $classes[] = 'acquia-lift-chosen-select';
  $options = array(
    'scope' => 'footer',
    'defer' => TRUE,
  );
  $element['#attributes'] = array(
    'class' => $classes,
    'data-placeholder' => t('Choose a context...'),
  );
  $element['#attached'] = array(
    'js' => array(
      $chosen_path . '/chosen.jquery.min.js' => array(
        'group' => 'JS_LIBRARY',
      ),
      drupal_get_path('module', 'acquia_lift') . '/js/acquia_lift.admin.js' => $options,
    ),
    'css' => array(
      $chosen_path . '/chosen.css' => array(),
    ),
  );
}