You are here

function jquerymobile_element_info_alter in jQuery Mobile module 7

Same name and namespace in other branches
  1. 7.2 jquerymobile.module \jquerymobile_element_info_alter()

Implements hook_element_info_alter().

File

./jquerymobile.module, line 56
Provides the jQuery Mobile library to modules and themes that request it.

Code

function jquerymobile_element_info_alter(&$type) {

  // add a custom pre_render function to checkboxes elements
  if (isset($type['checkboxes']['#pre_render'])) {
    $type['checkboxes']['#pre_render'][] = 'jquerymobile_pre_render_checkboxes';
  }
  else {
    $type['checkboxes']['#pre_render'] = array(
      'jquerymobile_pre_render_checkboxes',
    );
  }

  // add default #multiple value to checkboxes as false
  if (!isset($type['checkbox']['#multiple'])) {
    $type['checkbox']['#multiple'] = FALSE;
  }

  // add a new process function to actions type
  // add a custom pre_render function to checkboxes elements
  if (isset($type['actions']['#process'])) {
    $type['actions']['#process'][] = 'jquerymobile_process_actions';
  }
  else {
    $type['actions']['#process'] = array(
      'jquerymobile_process_actions',
    );
  }
  if (isset($type['text_format'])) {
    $type['text_format']['#process'][] = 'jquerymobile_process_text_format';
  }
}