You are here

function jquerymobile_library in jQuery Mobile module 7.2

Implements hook_library().

File

./jquerymobile.module, line 110

Code

function jquerymobile_library() {
  $libraries = array();
  $min = variable_get('jquerymobile_minify', FALSE) ? '.min' : '';
  $path = variable_get('jquerymobile_library_path', 'sites/all/libraries');
  switch (variable_get('jquerymobile_server_type', 'local')) {
    case 'hosted':
      $jquery_path = 'http://code.jquery.com';
      $jqm_path = 'http://code.jquery.com/mobile/' . variable_get('jquerymobile_jquerymobile_version', '1.0.1');
      $option = 'external';
      break;
    case 'other':
      $jqm_path = variable_get('jquerymobile_jqm_files_path', NULL);
      $jquery_path = variable_get('jquerymobile_jquery_files_path', NULL);
      $option = 'external';
      break;
    default:
      $jqm_path = $path . '/jquery.mobile-' . variable_get('jquerymobile_jquerymobile_version', '1.0.1');
      $jquery_path = $path . '/jquery-' . variable_get('jquerymobile_jquery_version', '1.6.4');
      $option = 'file';
      break;
  }
  $libraries['jquerymobile'] = array(
    'title' => 'jQuery Mobile',
    'website' => 'http://jquerymobile.com/',
    'version' => variable_get('jquerymobile_jquerymobile_version', '1.0.1'),
    'js' => array(
      $jqm_path . '/jquery.mobile-' . variable_get('jquerymobile_jquerymobile_version', '1.0.1') . $min . '.js' => array(
        'group' => JS_THEME,
        'weight' => 102,
        'type' => $option,
      ),
    ),
    'css' => array(
      $jqm_path . '/jquery.mobile-' . variable_get('jquerymobile_jquerymobile_version', '1.0.1') . $min . '.css' => array(
        'weight' => 101,
        'type' => $option,
        'group' => CSS_THEME,
        'every_page' => TRUE,
        'media' => 'all',
        'preprocess' => FALSE,
      ),
    ),
  );
  $libraries['jquerymobile.custom'] = array(
    'title' => 'jQuery Mobile',
    'website' => 'http://jquerymobile.com/',
    'version' => variable_get('jquerymobile_jquerymobile_version', '1.0.1'),
    'js' => array(
      $jqm_path . '/jquery.mobile-' . variable_get('jquerymobile_jquerymobile_version', '1.0.1') . $min . '.js' => array(
        'group' => JS_THEME,
        'weight' => 102,
        'type' => $option,
      ),
    ),
    'css' => array(
      $jqm_path . '/jquery.mobile.structure-' . variable_get('jquerymobile_jquerymobile_version', '1.0.1') . $min . '.css' => array(
        'weight' => 101,
        'type' => $option,
        'group' => CSS_THEME,
        'every_page' => TRUE,
        'media' => 'all',
        'preprocess' => FALSE,
      ),
    ),
  );
  $libraries['jquerymobile.jquery'] = array(
    'title' => 'jQuery',
    'website' => 'http://code.jquery.com/',
    'version' => variable_get('jquerymobile_jquery_version', '1.6.4'),
    'js' => array(
      $jquery_path . '/jquery-' . variable_get('jquerymobile_jquery_version', '1.6.4') . $min . '.js' => array(
        'group' => JS_THEME,
        'weight' => 101,
        'type' => $option,
        'scope' => 'header',
        'every_page' => TRUE,
        'preprocess' => TRUE,
        'cache' => TRUE,
        'defer' => FALSE,
      ),
    ),
  );
  return $libraries;
}