You are here

function mathjax_global_settings in MathJax: LaTeX for Drupal 7

Same name and namespace in other branches
  1. 6 mathjax.module \mathjax_global_settings()
  2. 7.2 mathjax.module \mathjax_global_settings()

Configure global settings for MathJax.

1 string reference to 'mathjax_global_settings'
mathjax_menu in ./mathjax.module
Implements hook_menu().

File

./mathjax.module, line 137
MathJax module.

Code

function mathjax_global_settings() {
  $form['mathjax']['mathjax_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Global switch'),
    '#default_value' => variable_get('mathjax_enabled', TRUE),
    '#description' => t('Check this box to enable MathJax for the entire site.'),
  );
  $form['mathjax']['mathjax_use_cdn'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use MathJax Content Delivery Network (CDN)'),
    '#default_value' => variable_get('mathjax_use_cdn', TRUE),
    '#description' => t('Check this box to load MathJax source from MathJax servers (recommended) or from the link you can provide below.'),
  );
  $form['mathjax']['mathjax_cdn_url'] = array(
    '#type' => 'textfield',
    '#title' => t('MathJax CDN url'),
    '#default_value' => variable_get('mathjax_cdn_url', mathjax_default_cdn_url()),
    '#description' => t("Enter the Mathjax CDN url here or leave it unchanged to use the one provided by <a target='_blank' href='@mathjax-homepage'>www.mathjax.org</a>.", array(
      '@mathjax-homepage' => 'http://www.mathjax.org',
    )),
  );
  $form['mathjax']['mathjax_config_string'] = array(
    '#type' => 'textarea',
    '#title' => t('MathJax configuration'),
    '#default_value' => variable_get('mathjax_config_string', mathjax_default_config_string()),
    '#description' => t("Enter a javascript configuration string as documented on  <a target='_blank' href='@mathjax-help'>MathJax help</a> Use with caution as you may introduce javascript errors.", array(
      '@mathjax-help' => 'http://docs.mathjax.org/en/latest/',
    )),
  );
  $form['mathjax']['active'] = array(
    '#type' => 'fieldset',
    '#title' => t('Page specific activation settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['mathjax']['active']['mathjax_active_type'] = array(
    '#type' => 'radios',
    '#title' => t('Enable MathJax on specific pages'),
    '#options' => array(
      'disable' => 'Enable on every page except the listed pages.',
      'enable' => 'Enable on the listed pages only.',
    ),
    '#default_value' => variable_get('mathjax_active_type', 'disable'),
  );
  $form['mathjax']['active']['mathjax_pages'] = array(
    '#type' => 'textarea',
    '#title' => t('Pages'),
    '#default_value' => variable_get('mathjax_pages', "admin*\nnode/add/*\nnode/*/edit"),
    '#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array(
      '%blog' => 'blog',
      '%blog-wildcard' => 'blog/*',
      '%front' => '<front>',
    )),
  );
  return system_settings_form($form);
}