You are here

function jquerymobile_admin_local_settings in jQuery Mobile module 7.2

Create the admin local settings form.

1 string reference to 'jquerymobile_admin_local_settings'
jquerymobile_menu in ./jquerymobile.module
Implements hook_menu().

File

./jquerymobile.admin.inc, line 113
Admin settings for the jquerymobile module.

Code

function jquerymobile_admin_local_settings($form, &$form_state, $theme = NULL) {
  $settings = _jquerymobile_get_settings($theme);

  /* OPTIONS VALUES */
  $transitions = array(
    '' => t('default'),
    'slide' => t('slide'),
    'slideup' => t('slideup'),
    'slidedown' => t('slidedown'),
    'pop' => t('pop'),
    'fade' => t('fade'),
  );
  $booleans = array(
    1 => t('True'),
    0 => t('False'),
  );
  $form['jquerymobile']['theme'] = array(
    '#type' => 'hidden',
    '#default_value' => $settings['theme'] ? $settings['theme'] : $theme,
  );

  /* THEME SETTINGS */
  $form['jquerymobile']['theme_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Display Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#access' => user_access('manage jquerymobile advanced settings'),
  );
  $form['jquerymobile']['theme_settings']['front'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display "River of News" as a list'),
    '#description' => t('If the front page is the default river of news, this option will create a link list form the teasers.'),
    '#default_value' => $settings['front'],
  );
  $form['jquerymobile']['theme_settings']['custom_themes'] = array(
    '#type' => 'textarea',
    '#default_value' => $settings['custom_themes'],
    '#title' => t('Custom CSS Swatches'),
    '#description' => t('Add new swatches or rename existing swatches. One per line, in <em>css_key|value</em> format, like <em>a|My Swatch</em> or <em>g|Red</em><br><em><strong>Note: </strong>If there are any custom themes listed then the default swatch css file will be replaced with the following file automatically and the jQuery Mobile structure file will be added.</em>'),
  );
  $form['jquerymobile']['theme_settings']['jquerymobile_custom_path'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('jquerymobile_custom_path', drupal_get_path('theme', $theme) . '/styles/jquery.mobile.overrides.css'),
    '#title' => t('Local File Location'),
    '#description' => t('Enter the location where the customized jquerymobile css files are located (no leading slash).'),
  );
  $form['jquerymobile']['advanced_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced Settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
    '#access' => user_access('manage jquerymobile advanced settings'),
  );

  /* ns */
  $form['jquerymobile']['advanced_settings']['ns'] = array(
    '#type' => 'textfield',
    '#title' => t('Namespace') . ' (<em>ns</em>)',
    '#default_value' => $settings['ns'],
    '#description' => t('The namespace used in data- attributes, for example, data-role. Can be set to anything, including a blank string which is the default. When using, it\'s clearest if you include a trailing dash, such as "mynamespace-" which maps to data-mynamespace-foo="...".<br />NOTE: if you\'re using data- namespacing, you\'ll need to manually update/override one selector in the theme CSS. The following data selectors should incorporate the namespace you\'re using:<br />.ui-mobile [data-mynamespace-role=page], .ui-mobile [data-mynamespace-role=dialog], .ui-page { ...'),
  );

  /* autoInitializePage */
  $form['jquerymobile']['advanced_settings']['autoInitializePage'] = array(
    '#type' => 'radios',
    '#title' => t('Auto Initialize Page') . ' (<em>autoInitializePage</em>)',
    '#default_value' => $settings['autoInitializePage'],
    '#description' => t('When the DOM is ready, the framework should automatically call $.mobile.initializePage. If FALSE, page will not initialize, and will be visually hidden until until $.mobile.initializePage is manually called.'),
    '#options' => $booleans,
  );

  /* subPageUrlKey */
  $form['jquerymobile']['advanced_settings']['subPageUrlKey'] = array(
    '#type' => 'textfield',
    '#title' => t('Sub Page URL Key') . ' (<em>subPageUrlKey</em>)',
    '#default_value' => $settings['subPageUrlKey'],
    '#description' => t('The url parameter used for referencing widget-generated sub-pages (such as those generated by nested listviews). Translates to to example.html&ui-page=subpageIdentifier. The hash segment before &ui-page= is used by the framework for making an Ajax request to the URL where the sub-page exists.'),
  );

  /* activePageClass */
  $form['jquerymobile']['advanced_settings']['activePageClass'] = array(
    '#type' => 'textfield',
    '#title' => t('Active Page Class') . ' (<em>activePageClass</em>)',
    '#default_value' => $settings['activePageClass'],
    '#description' => t('The class assigned to page currently in view, and during transitions'),
  );

  /* activeBtnClass */
  $form['jquerymobile']['advanced_settings']['activeBtnClass'] = array(
    '#type' => 'textfield',
    '#title' => t('Active Button Class') . ' (<em>activeBtnClass</em>)',
    '#default_value' => $settings['activeBtnClass'],
    '#description' => t('The class used for "active" button state, from CSS framework.'),
  );

  /* ajaxEnabled */
  $form['jquerymobile']['advanced_settings']['ajaxEnabled'] = array(
    '#type' => 'radios',
    '#title' => t('AJAX Enabled') . ' (<em>ajaxEnabled</em>)',
    '#default_value' => $settings['ajaxEnabled'],
    '#description' => t('jQuery Mobile will automatically handle link clicks and form submissions through Ajax, when possible. If FALSE, url hash listening will be disabled as well, and urls will load as regular http requests.'),
    '#options' => $booleans,
  );

  /* linkBindingEnabled */
  $form['jquerymobile']['advanced_settings']['linkBindingEnabled'] = array(
    '#type' => 'radios',
    '#title' => t('Link Binding Enabled') . ' (<em>linkBindingEnabled</em>)',
    '#default_value' => $settings['linkBindingEnabled'],
    '#description' => t('jQuery Mobile will automatically bind the clicks on anchor tags in your document. Setting this options to FALSE will prevent all anchor click handling including the addition of active button state and alternate link bluring. This should only be used when attempting to delegate the click management to another library or custom code.'),
    '#options' => $booleans,
  );

  /* hashListeningEnabled */
  $form['jquerymobile']['advanced_settings']['hashListeningEnabled'] = array(
    '#type' => 'radios',
    '#title' => t('Hash Listening Enabled') . ' (<em>hashListeningEnabled</em>)',
    '#default_value' => $settings['hashListeningEnabled'],
    '#description' => t('jQuery Mobile will automatically listen and handle changes to the location.hash. Disabling this will prevent jQuery Mobile from handling hash changes, which allows you to handle them yourself, or simply to use simple deep-links within a document that scroll to a particular ID.'),
    '#options' => $booleans,
  );

  /* pushStateEnabled */
  $form['jquerymobile']['advanced_settings']['pushStateEnabled'] = array(
    '#type' => 'radios',
    '#title' => t('Push State Enabled') . ' (<em>pushStateEnabled</em>)',
    '#default_value' => $settings['pushStateEnabled'],
    '#description' => t('Enhancement to use history.replaceState in supported browsers, to convert the hash-based Ajax URL into the full document path. Note that we <a href="http://jquerymobile.com/demos/1.0/docs/pages/page-navmodel.html">recommend</a> disabling this feature if Ajax is disabled or if extensive use of external links are used.'),
    '#options' => $booleans,
  );

  /* defaultPageTransition */
  $form['jquerymobile']['advanced_settings']['defaultPageTransition'] = array(
    '#type' => 'select',
    '#title' => t('Default Page Transition') . ' (<em>defaultPageTransition</em>)',
    '#default_value' => $settings['defaultPageTransition'],
    '#description' => t("Set the default transition for page changes that use Ajax. Set to 'none' for no transitions by default."),
    '#options' => $transitions,
  );

  /* touchOverflowEnabled */
  $form['jquerymobile']['advanced_settings']['touchOverflowEnabled'] = array(
    '#type' => 'radios',
    '#title' => t('Touch Overflow Enabled') . ' (<em>touchOverflowEnabled</em>)',
    '#default_value' => $settings['touchOverflowEnabled'],
    '#description' => t('Enable smoother page transitions and TRUE fixed toolbars in devices that support both the overflow: and overflow-scrolling: touch; CSS properties.'),
    '#options' => $booleans,
  );

  /* defaultDialogTransition */
  $form['jquerymobile']['advanced_settings']['defaultDialogTransition'] = array(
    '#type' => 'select',
    '#title' => t('Default Dialog Transition') . ' (<em>defaultDialogTransition</em>)',
    '#default_value' => $settings['defaultDialogTransition'],
    '#description' => t("Set the default transition for dialog changes that use Ajax. Set to 'none' for no transitions by default."),
    '#options' => $transitions,
  );

  /* minScrollBack */
  $form['jquerymobile']['advanced_settings']['minScrollBack'] = array(
    '#type' => 'textfield',
    '#title' => t('Minimum Scroll Back') . ' (<em>minScrollBack</em>)',
    '#default_value' => $settings['minScrollBack'],
    '#description' => t('Minimum scroll distance that will be remembered when returning to a page.'),
  );

  /* loadingMessage */
  $form['jquerymobile']['advanced_settings']['loadingMessage'] = array(
    '#type' => 'textfield',
    '#title' => t('Loading Message') . ' (<em>loadingMessage</em>)',
    '#default_value' => $settings['loadingMessage'],
    '#description' => t('Set the text that appears when a page is loading. If set to FALSE, the message will not appear at all.'),
  );

  /* pageLoadErrorMessage */
  $form['jquerymobile']['advanced_settings']['pageLoadErrorMessage'] = array(
    '#type' => 'textfield',
    '#title' => t('Page Load Error Message') . ' (<em>pageLoadErrorMessage</em>)',
    '#default_value' => $settings['pageLoadErrorMessage'],
    '#description' => t('Set the text that appears when a page fails to load through Ajax.'),
  );
  $form['#validate'][] = 'jquerymobile_admin_local_settings_validate';
  $form['#submit'][] = 'jquerymobile_admin_local_settings_submit';
  return system_settings_form($form);
}