You are here

function jquerymobile_process_actions in jQuery Mobile module 7

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

custom processing for form actions set them up as a jqm grid @todo need to be able to turn this on/off (per action set?)

1 string reference to 'jquerymobile_process_actions'
jquerymobile_element_info_alter in ./jquerymobile.module
Implements hook_element_info_alter().

File

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

Code

function jquerymobile_process_actions($element) {
  $number_letters = array(
    1 => 'a',
    2 => 'b',
    3 => 'c',
    4 => 'd',
    5 => 'e',
  );
  $children = element_children($element);
  $count = count($children) - 1;
  if ($count) {
    $element['#attributes']['class'][] = 'ui-grid-' . $number_letters[$count];
    $grid_block_count = 1;
    foreach ($children as $key) {
      $element[$key]['#prefix'] = '<div class="ui-block-' . $number_letters[$grid_block_count] . '">';
      $element[$key]['#suffix'] = '</div>';
      $grid_block_count++;
    }
  }
  return $element;
}