core/modules/editor/editor.api.php | 63 ---------------------- core/modules/editor/src/Entity/Editor.php | 7 +-- core/modules/editor/src/Tests/EditorAdminTest.php | 2 - .../editor/src/Tests/QuickEditIntegrationTest.php | 11 ---- .../editor/tests/modules/editor_test.module | 21 -------- 5 files changed, 1 insertion(+), 103 deletions(-) diff --git a/core/modules/editor/editor.api.php b/core/modules/editor/editor.api.php index 6244e7b..66c5d2a 100644 --- a/core/modules/editor/editor.api.php +++ b/core/modules/editor/editor.api.php @@ -27,69 +27,6 @@ function hook_editor_info_alter(array &$editors) { } /** - * Provides defaults for editor instances. - * - * Modules that extend the list of settings for a particular text editor library - * should specify defaults for those settings using this hook. These settings - * will be used for any new editors, as well as merged into any existing editor - * configuration that has not yet been provided with a specific value for a - * setting (as may happen when a module providing a new setting is enabled after - * the text editor has been configured). - * - * Note that only the top-level of this array is merged into the defaults. If - * multiple modules provide nested settings with the same top-level key, only - * the first will be used. Modules should avoid deep nesting of settings to - * avoid defaults being undefined. - * - * The return value of this hook is not cached. If retrieving defaults in a - * complex manner, the implementing module should provide its own caching inside - * the hook. - * - * @param $editor - * A string indicating the name of the editor library whose default settings - * are being provided. - * - * @return array - * An array of default settings that will be merged into the editor defaults. - */ -function hook_editor_default_settings($editor) { - return array( - 'mymodule_new_setting1' => TRUE, - 'mymodule_new_setting2' => array( - 'foo' => 'baz', - 'bar' => 'qux', - ), - ); -} - -/** - * Modifies default settings for editor instances. - * - * Modules that extend the behavior of other modules may use this hook to change - * the default settings provided to new and existing editors. This hook should - * be used when changing an existing setting to a new value. To add a new - * default setting, hook_editor_default_settings() should be used. - * - * The return value of this hook is not cached. If retrieving defaults in a - * complex manner, the implementing module should provide its own caching inside - * the hook. - * - * @param $default_settings - * The array of default settings which may be modified, passed by reference. - * @param $editor - * A string indicating the name of the editor library whose default settings - * are being provided. - * - * @return array - * An array of default settings that will be merged into the editor defaults. - * - * @see hook_editor_default_settings() - */ -function hook_editor_default_settings_alter(&$default_settings, $editor) { - $default_settings['toolbar'] = array('Bold', 'Italics', 'Underline'); -} - -/** * Modifies JavaScript settings that are added for text editors. * * @param array $settings diff --git a/core/modules/editor/src/Entity/Editor.php b/core/modules/editor/src/Entity/Editor.php index 1c93a52..71cfbef 100644 --- a/core/modules/editor/src/Entity/Editor.php +++ b/core/modules/editor/src/Entity/Editor.php @@ -80,12 +80,7 @@ public function __construct(array $values, $entity_type) { parent::__construct($values, $entity_type); $plugin = $this->editorPluginManager()->createInstance($this->editor); - - // Initialize settings, merging module-provided defaults. - $default_settings = $plugin->getDefaultSettings(); - $default_settings += \Drupal::moduleHandler()->invokeAll('editor_default_settings', array($this->editor)); - \Drupal::moduleHandler()->alter('editor_default_settings', $default_settings, $this->editor); - $this->settings += $default_settings; + $this->settings += $plugin->getDefaultSettings(); } /** diff --git a/core/modules/editor/src/Tests/EditorAdminTest.php b/core/modules/editor/src/Tests/EditorAdminTest.php index 1e72494..ab79287 100644 --- a/core/modules/editor/src/Tests/EditorAdminTest.php +++ b/core/modules/editor/src/Tests/EditorAdminTest.php @@ -155,8 +155,6 @@ protected function verifyUnicornEditorConfiguration($format_id, $foo = 'bar') { $this->assertIdentical($editor->getEditor(), 'unicorn', 'The text editor is configured correctly.'); $this->assertIdentical($settings['foo'], $foo, 'The text editor settings are stored correctly.'); $this->assertIdentical($settings['ponies_too'], true, 'The text editor defaults are retrieved correctly.'); - $this->assertIdentical($settings['rainbows'], true, 'The text editor defaults added by hook_editor_settings_defaults() are retrieved correctly.'); - $this->assertIdentical($settings['sparkles'], false, 'The text editor defaults modified by hook_editor_settings_defaults_alter() are retrieved correctly.'); $this->drupalGet('admin/config/content/formats/manage/'. $format_id); $select = $this->xpath('//select[@name="editor[editor]"]'); $select_is_disabled = $this->xpath('//select[@name="editor[editor]" and @disabled="disabled"]'); diff --git a/core/modules/editor/src/Tests/QuickEditIntegrationTest.php b/core/modules/editor/src/Tests/QuickEditIntegrationTest.php index 9f70a14..33077c3 100644 --- a/core/modules/editor/src/Tests/QuickEditIntegrationTest.php +++ b/core/modules/editor/src/Tests/QuickEditIntegrationTest.php @@ -25,17 +25,6 @@ class QuickEditIntegrationTest extends QuickEditTestBase { /** - * Set to TRUE to strict check all configuration saved. - * - * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker - * - * @todo Altering not schema compatible. https://www.drupal.org/node/2389697 - * - * @var bool - */ - protected $strictConfigSchema = FALSE; - - /** * {@inheritdoc} */ public static $modules = array('editor', 'editor_test'); diff --git a/core/modules/editor/tests/modules/editor_test.module b/core/modules/editor/tests/modules/editor_test.module index f9e8394..45d1f82 100644 --- a/core/modules/editor/tests/modules/editor_test.module +++ b/core/modules/editor/tests/modules/editor_test.module @@ -8,27 +8,6 @@ use Drupal\filter\FilterFormatInterface; /** - * 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) {