editor_test.module

Helper module for the Text Editor tests.

File

drupal/core/modules/editor/tests/modules/editor_test.module
View source
<?php

/**
 * @file
 * Helper module for the Text Editor tests.
 */

/**
 * Implements hook_editor_default_settings().
 */
function editor_test_editor_default_settings($editor) {
  if ($editor === 'unicorn') {
    return array(
      'rainbows' => TRUE,
      'sparkles' => TRUE,
    );
  }
}

/**
 * Implements hook_editor_default_settings_alter().
 */
function editor_test_editor_default_settings_alter(&$settings, $editor) {
  if ($editor === 'unicorn' && isset($settings['sparkles'])) {
    $settings['sparkles'] = FALSE;
  }
}

/**
 * Implements hook_editor_js_settings_alter().
 */
function editor_test_editor_js_settings_alter(&$settings) {

  // Allow tests to enable or disable this alter hook.
  if (!Drupal::state()
    ->get('editor_test_js_settings_alter_enabled', FALSE)) {
    return;
  }
  if (isset($settings['full_html'])) {
    $settings['full_html']['editorSettings']['ponyModeEnabled'] = FALSE;
  }
}

Functions