accessibility-8.x-1.x-dev/modules/accessibility_wysiwyg/accessibility_wysiwyg.module
modules/accessibility_wysiwyg/accessibility_wysiwyg.module
<?php /** * Helper function to load accessibility javascript. */ function accessibility_wysiwyg_load() { $loaded = &drupal_static(__FUNCTION__); if($loaded) { return; } $loaded = TRUE; accessibility_load(); drupal_add_css(drupal_get_path('module', 'accessibility_wysiwyg') . '/css/accessibility_wysiwyg.css'); drupal_add_js(array('accessibility_wysiwyg' => array( 'path' => drupal_get_path('module', 'accessibility_wysiwyg'), 'css' => file_get_contents(drupal_get_path('module', 'accessibility') .'/css/accessibility.css'), 'accessibility_path' => drupal_get_path('module', 'accessibility'))), 'setting'); } /** * Implements hook_element_info_alter(). */ function accessibility_wysiwyg_element_info_alter(&$types) { $types['text_format']['#pre_render'][] = 'accessibility_wysiwyg_pre_render_text_format'; } /** * Alter callback to see if accessibility javascript should be loaded on the current page. * @todo - This will turn on for every form whenever ckeditor is installed, should only * turn on when the current page is included in the global profile. * @todo - this should be smarter about whether the page needs to load the JS or not. */ function accessibility_wysiwyg_pre_render_text_format($element) { if (!isset($element['format']) || !empty($element['value']['#disabled'])) { return $element; } accessibility_wysiwyg_load(); return $element; }