You are here

function fontawesome_iconpicker_process_element in Font Awesome Iconpicker 7

Attaches javascript and css to the text element.

See also

fontawesome_iconpicker_element_info()

1 string reference to 'fontawesome_iconpicker_process_element'
fontawesome_iconpicker_element_info in ./fontawesome_iconpicker.module
Implements hook_element_info().

File

./fontawesome_iconpicker.module, line 176
Integrates fontawesome-iconpicker plugin with Drupal.

Code

function fontawesome_iconpicker_process_element($element, $form_state, $form) {
  libraries_load(FONTAWESOME_ICONPICKER_LIBRARY);
  $js_path = drupal_get_path('module', 'fontawesome_iconpicker') . '/fontawesome_iconpicker.js';
  $css_path = drupal_get_path('module', 'fontawesome_iconpicker') . '/fontawesome_iconpicker.css';
  $element['#attributes']['data-iconpicker'] = '';
  $element['#attributes']['class'][] = 'fontawesome-iconpicker-element';
  $element['#attached']['js'][] = $js_path;
  $element['#attached']['css'][] = $css_path;
  return $element;
}