accessibility_wysiwyg.module

  1. cis7 sites/all/modules/ulmus/accessibility/modules/accessibility_wysiwyg/accessibility_wysiwyg.module
  2. cle7 sites/all/modules/ulmus/accessibility/modules/accessibility_wysiwyg/accessibility_wysiwyg.module
  3. ecd7 sites/all/modules/ulmus/accessibility/modules/accessibility_wysiwyg/accessibility_wysiwyg.module
  4. elmsmedia7 sites/all/modules/ulmus/accessibility/modules/accessibility_wysiwyg/accessibility_wysiwyg.module
  5. harmony7 sites/all/modules/ulmus/accessibility/modules/accessibility_wysiwyg/accessibility_wysiwyg.module
  6. icor7 sites/all/modules/ulmus/accessibility/modules/accessibility_wysiwyg/accessibility_wysiwyg.module
  7. meedjum_blog7 sites/all/modules/ulmus/accessibility/modules/accessibility_wysiwyg/accessibility_wysiwyg.module
  8. mooc7 sites/all/modules/ulmus/accessibility/modules/accessibility_wysiwyg/accessibility_wysiwyg.module

Functions

Namesort descending Description
accessibility_wysiwyg_ckeditor_plugin Implements hook_ckeditor_plugin().
accessibility_wysiwyg_element_info_alter Implements hook_element_info_alter().
accessibility_wysiwyg_load Helper function to load accessibility javascript.
accessibility_wysiwyg_menu Implements hook_menu().
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.
accessibility_wysiwyg_tinymce_view_errors Menu callback to render out accessibility errors.
accessibility_wysiwyg_wysiwyg_plugin Implements hook_wysiwyg_plugin().

File

sites/all/modules/ulmus/accessibility/modules/accessibility_wysiwyg/accessibility_wysiwyg.module
View source
  1. <?php
  2. /**
  3. * Implements hook_menu().
  4. */
  5. function accessibility_wysiwyg_menu() {
  6. $items = array();
  7. $items['accessibility_wysiwyg/tinymce/view/%'] = array(
  8. 'title' => 'Accessibility',
  9. 'page callback' => 'accessibility_wysiwyg_tinymce_view_errors',
  10. 'page arguments' => array(3),
  11. 'access arguments' => array('view accessibility tests'),
  12. 'type' => MENU_CALLBACK
  13. );
  14. return $items;
  15. }
  16. /**
  17. * Menu callback to render out accessibility errors.
  18. */
  19. function accessibility_wysiwyg_tinymce_view_errors($tests) {
  20. $tests = explode(',', $tests);
  21. $output = '';
  22. foreach($tests as $test) {
  23. $test = accessibility_test_load($test);
  24. $output .= '<h2>'. $test->name .'</h2>';
  25. $output .= drupal_render(accessibility_test_page_view($test));
  26. }
  27. print $output;
  28. drupal_exit();
  29. }
  30. /**
  31. * Implements hook_wysiwyg_plugin().
  32. */
  33. function accessibility_wysiwyg_wysiwyg_plugin($editor, $version) {
  34. switch ($editor) {
  35. case 'tinymce':
  36. if ($version > 3) {
  37. return array(
  38. 'drupal_accessibility' => array(
  39. 'url' => 'http://drupal.org/project/accessibility',
  40. 'path' => drupal_get_path('module', 'accessibility_wysiwyg') . '/plugins/tinymce',
  41. 'filename' => 'tinymce.js',
  42. 'buttons' => array(
  43. 'drupal_accessibility' => t('Accessibility'),
  44. ),
  45. 'load' => TRUE,
  46. 'internal' => FALSE
  47. ),
  48. );
  49. }
  50. break;
  51. case 'ckeditor':
  52. if ($version >= 4) {
  53. return array(
  54. 'drupal_accessibility' => array(
  55. 'url' => 'http://drupal.org/project/accessibility',
  56. 'path' => drupal_get_path('module', 'accessibility_wysiwyg') . '/plugins/ckeditor4/drupal_accessibility',
  57. 'filename' => 'plugin.js',
  58. 'buttons' => array(
  59. 'drupal_accessibility' => t('Accessibility'),
  60. ),
  61. 'load' => TRUE,
  62. 'internal' => FALSE
  63. ),
  64. );
  65. }
  66. if ($version > 3) {
  67. return array(
  68. 'drupal_accessibility' => array(
  69. 'url' => 'http://drupal.org/project/accessibility',
  70. 'path' => drupal_get_path('module', 'accessibility_wysiwyg') . '/plugins/ckeditor3',
  71. 'filename' => 'plugin.js',
  72. 'buttons' => array(
  73. 'drupal_accessibility' => t('Accessibility'),
  74. ),
  75. 'load' => TRUE,
  76. 'internal' => FALSE
  77. ),
  78. );
  79. }
  80. break;
  81. }
  82. }
  83. /**
  84. * Helper function to load accessibility javascript.
  85. */
  86. function accessibility_wysiwyg_load() {
  87. accessibility_load();
  88. drupal_add_css(drupal_get_path('module', 'accessibility_wysiwyg') . '/css/accessibility_wysiwyg.css');
  89. drupal_add_js(array('accessibility_wysiwyg' => array(
  90. 'path' => drupal_get_path('module', 'accessibility_wysiwyg'),
  91. 'css' => file_get_contents(drupal_get_path('module', 'accessibility') .'/css/accessibility.css'),
  92. 'accessibility_path' => drupal_get_path('module', 'accessibility'))),
  93. 'setting');
  94. }
  95. /**
  96. * Implements hook_element_info_alter().
  97. */
  98. function accessibility_wysiwyg_element_info_alter(&$types) {
  99. $types['text_format']['#pre_render'][] = 'accessibility_wysiwyg_pre_render_text_format';
  100. }
  101. /**
  102. * Alter callback to see if accessibility javascript should be loaded on the current page.
  103. * @todo - This will turn on for every form whenever ckeditor is installed, should only
  104. * turn on when the current page is included in the global profile.
  105. */
  106. function accessibility_wysiwyg_pre_render_text_format($element) {
  107. if (!isset($element['format']) || !empty($element['value']['#disabled'])) {
  108. return $element;
  109. }
  110. if (module_exists('ckeditor')) {
  111. accessibility_wysiwyg_load();
  112. return $element;
  113. }
  114. if (module_exists('wysiwyg') && isset($element['#wysiwyg']) && !$element['#wysiwyg']) {
  115. return $element;
  116. }
  117. $format_field = &$element['format'];
  118. foreach ($format_field['format']['#options'] as $format_id => $format_name) {
  119. if (module_exists('wysiwyg')) {
  120. $profile = wysiwyg_get_profile($format_id);
  121. if ($profile) {
  122. accessibility_wysiwyg_load();
  123. return $element;
  124. }
  125. }
  126. }
  127. return $element;
  128. }
  129. /**
  130. * Implements hook_ckeditor_plugin().
  131. */
  132. function accessibility_wysiwyg_ckeditor_plugin() {
  133. return array(
  134. 'drupal_accessibility' => array(
  135. 'name' => 'drupal_accessibility',
  136. 'desc' => t('Plugin for giving authors feedback on accessibility issues.'),
  137. 'path' => drupal_get_path('module', 'accessibility_wysiwyg') . '/plugins/ckeditor4/drupal_accessibility/',
  138. 'buttons' => array(
  139. 'drupal_accessibility' => array(
  140. 'icon' => 'img/button.png',
  141. 'label' => t('Check accessibility'),
  142. )
  143. )
  144. )
  145. );
  146. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.