You are here

function acquia_lift_chosenify_element in Acquia Lift Connector 7.2

Same name and namespace in other branches
  1. 7 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.

2 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_personalize_campaign_wizard_variations_block in ./acquia_lift.admin.wizard.inc
Generate the blocks portion of the campaign wizard form.

File

./acquia_lift.ui.inc, line 95
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']['class'] = $classes;
  $element['#attributes']['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(),
    ),
  );
}