summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-02-16 01:15:43 (GMT)
committerNathaniel Catchpole2016-02-16 01:15:43 (GMT)
commitc3d6658c3ae45bda26a2baa11c9698db14d35dbb (patch)
tree36aad8eb1d8d848d821f79d784a75ad3cf584ea4
parentc3ae8b4c56ff898379527eb154f4a5a04909b110 (diff)
Issue #2641528 by heykarthikwithu, Mac_Weber, naveenvalecha: Replace deprecated usage of entity_create('editor') with a direct call to Editor::create()
-rw-r--r--core/modules/ckeditor/src/Plugin/Editor/CKEditor.php2
-rw-r--r--core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php5
-rw-r--r--core/modules/ckeditor/src/Tests/CKEditorPluginManagerTest.php5
-rw-r--r--core/modules/ckeditor/src/Tests/CKEditorTest.php4
-rw-r--r--core/modules/editor/editor.module4
-rw-r--r--core/modules/editor/src/Tests/EditorFileUsageTest.php5
-rw-r--r--core/modules/editor/src/Tests/EditorLoadingTest.php17
-rw-r--r--core/modules/editor/src/Tests/EditorManagerTest.php5
-rw-r--r--core/modules/editor/src/Tests/EditorSecurityTest.php13
-rw-r--r--core/modules/editor/src/Tests/QuickEditIntegrationTest.php5
10 files changed, 36 insertions, 29 deletions
diff --git a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
index cb3e7b5..8a30eea 100644
--- a/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
+++ b/core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
@@ -204,7 +204,7 @@ class CKEditor extends EditorBase implements ContainerFactoryPluginInterface {
}, array());
// Build a fake Editor object, which we'll use to generate JavaScript
// settings for this fake Editor instance.
- $fake_editor = entity_create('editor', array(
+ $fake_editor = Editor::create(array(
'format' => $editor->id(),
'editor' => 'ckeditor',
'settings' => array(
diff --git a/core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php b/core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php
index 1081eb9..8ee31ac 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php
@@ -7,6 +7,7 @@
namespace Drupal\ckeditor\Tests;
+use Drupal\editor\Entity\Editor;
use Drupal\simpletest\WebTestBase;
/**
@@ -48,10 +49,10 @@ class CKEditorLoadingTest extends WebTestBase {
'filters' => array(),
));
$filtered_html_format->save();
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => 'filtered_html',
'editor' => 'ckeditor',
- ));
+ ]);
$editor->save();
// Create a second format without an associated editor so a drop down select
diff --git a/core/modules/ckeditor/src/Tests/CKEditorPluginManagerTest.php b/core/modules/ckeditor/src/Tests/CKEditorPluginManagerTest.php
index aec8dbb..86aaf7e 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorPluginManagerTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorPluginManagerTest.php
@@ -7,6 +7,7 @@
namespace Drupal\ckeditor\Tests;
+use Drupal\editor\Entity\Editor;
use Drupal\simpletest\KernelTestBase;
/**
@@ -44,10 +45,10 @@ class CKEditorPluginManagerTest extends KernelTestBase {
'filters' => array(),
));
$filtered_html_format->save();
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => 'filtered_html',
'editor' => 'ckeditor',
- ));
+ ]);
$editor->save();
}
diff --git a/core/modules/ckeditor/src/Tests/CKEditorTest.php b/core/modules/ckeditor/src/Tests/CKEditorTest.php
index 708f091..3948ac2 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorTest.php
@@ -60,10 +60,10 @@ class CKEditorTest extends KernelTestBase {
),
));
$filtered_html_format->save();
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => 'filtered_html',
'editor' => 'ckeditor',
- ));
+ ]);
$editor->save();
// Create "CKEditor" text editor plugin instance.
diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module
index 8468caa..01d5c5e 100644
--- a/core/modules/editor/editor.module
+++ b/core/modules/editor/editor.module
@@ -178,10 +178,10 @@ function editor_form_filter_admin_format_editor_configure($form, FormStateInterf
}
elseif (empty($editor) || $editor_value !== $editor->getEditor()) {
$format = $form_state->getFormObject()->getEntity();
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => $format->isNew() ? NULL : $format->id(),
'editor' => $editor_value,
- ));
+ ]);
$form_state->set('editor', $editor);
}
}
diff --git a/core/modules/editor/src/Tests/EditorFileUsageTest.php b/core/modules/editor/src/Tests/EditorFileUsageTest.php
index 6e291d4..2d115d1 100644
--- a/core/modules/editor/src/Tests/EditorFileUsageTest.php
+++ b/core/modules/editor/src/Tests/EditorFileUsageTest.php
@@ -7,6 +7,7 @@
namespace Drupal\editor\Tests;
+use Drupal\editor\Entity\Editor;
use Drupal\system\Tests\Entity\EntityUnitTestBase;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
@@ -47,10 +48,10 @@ class EditorFileUsageTest extends EntityUnitTestBase {
->save();
// Set up text editor.
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => 'filtered_html',
'editor' => 'unicorn',
- ));
+ ]);
$editor->save();
// Create a node type for testing.
diff --git a/core/modules/editor/src/Tests/EditorLoadingTest.php b/core/modules/editor/src/Tests/EditorLoadingTest.php
index 002ccd3..eb4e08a 100644
--- a/core/modules/editor/src/Tests/EditorLoadingTest.php
+++ b/core/modules/editor/src/Tests/EditorLoadingTest.php
@@ -8,6 +8,7 @@
namespace Drupal\editor\Tests;
use Drupal\Core\Entity\Entity;
+use Drupal\editor\Entity\Editor;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\simpletest\WebTestBase;
@@ -113,7 +114,7 @@ class EditorLoadingTest extends WebTestBase {
*/
public function testLoading() {
// Only associate a text editor with the "Full HTML" text format.
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => 'full_html',
'editor' => 'unicorn',
'image_upload' => array(
@@ -123,7 +124,7 @@ class EditorLoadingTest extends WebTestBase {
'max_size' => '',
'max_dimensions' => array('width' => '', 'height' => ''),
)
- ));
+ ]);
$editor->save();
// The normal user:
@@ -166,10 +167,10 @@ class EditorLoadingTest extends WebTestBase {
$this->drupalLogout($this->privilegedUser);
// Also associate a text editor with the "Plain Text" text format.
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => 'plain_text',
'editor' => 'unicorn',
- ));
+ ]);
$editor->save();
// The untrusted user:
@@ -221,7 +222,7 @@ class EditorLoadingTest extends WebTestBase {
*/
public function testSupportedElementTypes() {
// Associate the unicorn text editor with the "Full HTML" text format.
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => 'full_html',
'editor' => 'unicorn',
'image_upload' => array(
@@ -231,7 +232,7 @@ class EditorLoadingTest extends WebTestBase {
'max_size' => '',
'max_dimensions' => array('width' => '', 'height' => ''),
)
- ));
+ ]);
$editor->save();
// Create an "page" node that uses the full_html text format.
@@ -255,10 +256,10 @@ class EditorLoadingTest extends WebTestBase {
// Associate the trex text editor with the "Full HTML" text format.
$editor->delete();
- entity_create('editor', array(
+ Editor::create([
'format' => 'full_html',
'editor' => 'trex',
- ))->save();
+ ])->save();
$this->drupalGet('node/1/edit');
list( , $editor_settings_present, $editor_js_present, $field, $format_selector) = $this->getThingsToCheck('field-text', 'input');
diff --git a/core/modules/editor/src/Tests/EditorManagerTest.php b/core/modules/editor/src/Tests/EditorManagerTest.php
index 9bb7a67..996d928 100644
--- a/core/modules/editor/src/Tests/EditorManagerTest.php
+++ b/core/modules/editor/src/Tests/EditorManagerTest.php
@@ -7,6 +7,7 @@
namespace Drupal\editor\Tests;
+use Drupal\editor\Entity\Editor;
use Drupal\simpletest\KernelTestBase;
/**
@@ -79,10 +80,10 @@ class EditorManagerTest extends KernelTestBase {
// Case 3: a text editor available & associated (but associated only with
// the 'Full HTML' text format).
$unicorn_plugin = $this->editorManager->createInstance('unicorn');
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => 'full_html',
'editor' => 'unicorn',
- ));
+ ]);
$editor->save();
$this->assertIdentical(array(), $this->editorManager->getAttachments(array()), 'No attachments when one text editor is enabled and retrieving attachments for zero text formats.');
$expected = array(
diff --git a/core/modules/editor/src/Tests/EditorSecurityTest.php b/core/modules/editor/src/Tests/EditorSecurityTest.php
index bb39450..5800a16 100644
--- a/core/modules/editor/src/Tests/EditorSecurityTest.php
+++ b/core/modules/editor/src/Tests/EditorSecurityTest.php
@@ -8,6 +8,7 @@
namespace Drupal\editor\Tests;
use Drupal\Component\Serialization\Json;
+use Drupal\editor\Entity\Editor;
use Drupal\simpletest\WebTestBase;
/**
@@ -116,10 +117,10 @@ class EditorSecurityTest extends WebTestBase {
),
));
$format->save();
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => 'restricted_with_editor',
'editor' => 'unicorn',
- ));
+ ]);
$editor->save();
$format = entity_create('filter_format', array(
'format' => 'restricted_plus_dangerous_tag_with_editor',
@@ -136,10 +137,10 @@ class EditorSecurityTest extends WebTestBase {
),
));
$format->save();
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => 'restricted_plus_dangerous_tag_with_editor',
'editor' => 'unicorn',
- ));
+ ]);
$editor->save();
$format = entity_create('filter_format', array(
'format' => 'unrestricted_without_editor',
@@ -155,10 +156,10 @@ class EditorSecurityTest extends WebTestBase {
'filters' => array(),
));
$format->save();
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => 'unrestricted_with_editor',
'editor' => 'unicorn',
- ));
+ ]);
$editor->save();
diff --git a/core/modules/editor/src/Tests/QuickEditIntegrationTest.php b/core/modules/editor/src/Tests/QuickEditIntegrationTest.php
index 188a38b..820cab6 100644
--- a/core/modules/editor/src/Tests/QuickEditIntegrationTest.php
+++ b/core/modules/editor/src/Tests/QuickEditIntegrationTest.php
@@ -10,6 +10,7 @@ namespace Drupal\editor\Tests;
use Drupal\Component\Serialization\Json;
use Drupal\Core\EventSubscriber\AjaxResponseSubscriber;
use Drupal\Core\Language\LanguageInterface;
+use Drupal\editor\Entity\Editor;
use Drupal\quickedit\MetadataGenerator;
use Drupal\quickedit\Tests\QuickEditTestBase;
use Drupal\quickedit_test\MockEditEntityFieldAccessCheck;
@@ -95,10 +96,10 @@ class QuickEditIntegrationTest extends QuickEditTestBase {
$full_html_format->save();
// Associate text editor with text format.
- $editor = entity_create('editor', array(
+ $editor = Editor::create([
'format' => $full_html_format->id(),
'editor' => 'unicorn',
- ));
+ ]);
$editor->save();
// Also create a text format without an associated text editor.