You are here

function editoria11y_preprocess_page in Editoria11y Accessibility Checker 7

Implements init()

@link https://api.drupal.org/api/drupal/modules%21node%21node.module/function/... Only load for authorized users viewing rendered (non-admin) content.

File

./editoria11y.module, line 147
Editoria11y module file.

Code

function editoria11y_preprocess_page(&$vars) {

  // Add JS & CSS by node type.
  if (user_access('use editoria11y checker') && !path_is_admin(current_path())) {
    $lastChanged = 0;
    if (isset($vars['node'])) {
      $lastChanged = $vars['node']->changed;
    }

    // Tell Javascript if slide counter is in use, add class for designers.
    $my_settings = array(
      'type' => 'setting',
      'data' => array(
        'assertiveness' => variable_get('editoria11y_assertiveness', 'smart'),
        'changed' => $lastChanged,
        'allow_overflow' => variable_get('editoria11y_allow_overflow', ''),
        'no_load' => variable_get('editoria11y_no_load', ''),
        'content_root' => variable_get('editoria11y_content_root', ''),
        'ignore_containers' => variable_get('editoria11y_ignore_containers', ''),
        'embedded_content_warning' => variable_get('editoria11y_embedded_content_warning', ''),
        'hidden_handlers' => variable_get('editoria11y_hidden_handlers', ''),
        'download_links' => variable_get('editoria11y_download_links', ''),
      ),
    );
    drupal_add_js(array(
      'editoria11y' => $my_settings,
    ), 'setting');
    drupal_add_js(drupal_get_path('module', 'editoria11y') . '/js/editoria11y-prefs.js', array(
      'scope' => 'footer',
    ));
    drupal_add_js(drupal_get_path('module', 'editoria11y') . '/js/editoria11y-localization.js', array(
      'scope' => 'footer',
    ));
    drupal_add_js(drupal_get_path('module', 'editoria11y') . '/js/editoria11y-drupal.js', array(
      'scope' => 'footer',
    ));
    drupal_add_css(drupal_get_path('module', 'editoria11y') . '/css/editoria11y.css', array(
      'scope' => 'footer',
    ));
  }
}