Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* - Drupal.editors.magical.attachInlineEditor()
|
||||
*/
|
||||
|
||||
(function ($, Drupal, drupalSettings) {
|
||||
(function ($, Drupal, drupalSettings, _) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -228,4 +228,4 @@
|
|||
|
||||
});
|
||||
|
||||
})(jQuery, Drupal, drupalSettings);
|
||||
})(jQuery, Drupal, drupalSettings, _);
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Ajax\EditorDialogSave.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Ajax;
|
||||
|
||||
use Drupal\Core\Ajax\CommandInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Ajax\GetUntransformedTextCommand.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Ajax;
|
||||
|
||||
use Drupal\Core\Ajax\BaseCommand;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Annotation\Editor.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Annotation;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\EditorController.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor;
|
||||
|
||||
use Drupal\Core\Ajax\AjaxResponse;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\EditorInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\EditorXssFilter\Standard.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\EditorXssFilter;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\EditorXssFilterInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor;
|
||||
|
||||
use Drupal\filter\FilterFormatInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Element.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor;
|
||||
|
||||
use Drupal\editor\Entity\Editor;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Entity\Editor.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Entity;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Form\EditorImageDialog.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Form;
|
||||
|
||||
use Drupal\Component\Utility\Bytes;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Form\EditorLinkDialog.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Form;
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Plugin\EditorBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Plugin;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Plugin\EditorManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Plugin;
|
||||
|
||||
use Drupal\Core\Plugin\DefaultPluginManager;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Plugin\EditorPluginInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Plugin;
|
||||
|
||||
use Drupal\Component\Plugin\PluginInspectionInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Plugin\Filter\EditorFileReference.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Plugin\Filter;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Plugin\InPlaceEditor\Editor.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Plugin\InPlaceEditor;
|
||||
|
||||
use Drupal\Component\Plugin\PluginBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Tests\EditorAdminTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Tests;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
|
@ -38,7 +33,7 @@ class EditorAdminTest extends WebTestBase {
|
|||
parent::setUp();
|
||||
|
||||
// Add text format.
|
||||
$filtered_html_format = entity_create('filter_format', array(
|
||||
$filtered_html_format = FilterFormat::create(array(
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'weight' => 0,
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Tests\EditorLoadingTest.
|
||||
*/
|
||||
|
||||
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;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
|
||||
/**
|
||||
* Tests loading of text editors.
|
||||
|
@ -55,14 +51,14 @@ class EditorLoadingTest extends WebTestBase {
|
|||
\Drupal::service('plugin.manager.editor')->clearCachedDefinitions();
|
||||
|
||||
// Add text formats.
|
||||
$filtered_html_format = entity_create('filter_format', array(
|
||||
$filtered_html_format = FilterFormat::create(array(
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'weight' => 0,
|
||||
'filters' => array(),
|
||||
));
|
||||
$filtered_html_format->save();
|
||||
$full_html_format = entity_create('filter_format', array(
|
||||
$full_html_format = FilterFormat::create(array(
|
||||
'format' => 'full_html',
|
||||
'name' => 'Full HTML',
|
||||
'weight' => 1,
|
||||
|
@ -113,7 +109,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 +119,7 @@ class EditorLoadingTest extends WebTestBase {
|
|||
'max_size' => '',
|
||||
'max_dimensions' => array('width' => '', 'height' => ''),
|
||||
)
|
||||
));
|
||||
]);
|
||||
$editor->save();
|
||||
|
||||
// The normal user:
|
||||
|
@ -166,10 +162,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 +217,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 +227,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 +251,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');
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Tests\EditorSecurityTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Tests;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
|
||||
/**
|
||||
* Tests XSS protection for content creators when using text editors.
|
||||
|
@ -86,7 +83,7 @@ class EditorSecurityTest extends WebTestBase {
|
|||
// With text formats 2, 3 and 5, we also associate a text editor that does
|
||||
// not guarantee XSS safety. "restricted" means the text format has XSS
|
||||
// filters on output, "unrestricted" means the opposite.
|
||||
$format = entity_create('filter_format', array(
|
||||
$format = FilterFormat::create(array(
|
||||
'format' => 'restricted_without_editor',
|
||||
'name' => 'Restricted HTML, without text editor',
|
||||
'weight' => 0,
|
||||
|
@ -101,7 +98,7 @@ class EditorSecurityTest extends WebTestBase {
|
|||
),
|
||||
));
|
||||
$format->save();
|
||||
$format = entity_create('filter_format', array(
|
||||
$format = FilterFormat::create(array(
|
||||
'format' => 'restricted_with_editor',
|
||||
'name' => 'Restricted HTML, with text editor',
|
||||
'weight' => 1,
|
||||
|
@ -116,12 +113,12 @@ 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 = FilterFormat::create(array(
|
||||
'format' => 'restricted_plus_dangerous_tag_with_editor',
|
||||
'name' => 'Restricted HTML, dangerous tag allowed, with text editor',
|
||||
'weight' => 1,
|
||||
|
@ -136,29 +133,29 @@ 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 = FilterFormat::create(array(
|
||||
'format' => 'unrestricted_without_editor',
|
||||
'name' => 'Unrestricted HTML, without text editor',
|
||||
'weight' => 0,
|
||||
'filters' => array(),
|
||||
));
|
||||
$format->save();
|
||||
$format = entity_create('filter_format', array(
|
||||
$format = FilterFormat::create(array(
|
||||
'format' => 'unrestricted_with_editor',
|
||||
'name' => 'Unrestricted HTML, with text editor',
|
||||
'weight' => 1,
|
||||
'filters' => array(),
|
||||
));
|
||||
$format->save();
|
||||
$editor = entity_create('editor', array(
|
||||
$editor = Editor::create([
|
||||
'format' => 'unrestricted_with_editor',
|
||||
'editor' => 'unicorn',
|
||||
));
|
||||
]);
|
||||
$editor->save();
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Tests\QuickEditIntegrationLoadingTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Tests;
|
||||
|
||||
use Drupal\Component\Serialization\Json;
|
||||
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
|
||||
/**
|
||||
* Tests Quick Edit module integration endpoints.
|
||||
|
@ -36,7 +32,7 @@ class QuickEditIntegrationLoadingTest extends WebTestBase {
|
|||
parent::setUp();
|
||||
|
||||
// Create a text format.
|
||||
$filtered_html_format = entity_create('filter_format', array(
|
||||
$filtered_html_format = FilterFormat::create(array(
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'weight' => 0,
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Tests\QuickEditIntegrationTest.
|
||||
*/
|
||||
|
||||
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\entity_test\Entity\EntityTest;
|
||||
use Drupal\quickedit\MetadataGenerator;
|
||||
use Drupal\quickedit\Tests\QuickEditTestBase;
|
||||
use Drupal\quickedit_test\MockEditEntityFieldAccessCheck;
|
||||
|
@ -17,6 +14,7 @@ use Drupal\editor\EditorController;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
|
||||
/**
|
||||
* Tests Edit module integration (Editor module's inline editing support).
|
||||
|
@ -69,7 +67,6 @@ class QuickEditIntegrationTest extends QuickEditTestBase {
|
|||
parent::setUp();
|
||||
|
||||
// Install the Filter module.
|
||||
$this->installSchema('system', 'url_alias');
|
||||
|
||||
// Create a field.
|
||||
$this->fieldName = 'field_textarea';
|
||||
|
@ -86,7 +83,7 @@ class QuickEditIntegrationTest extends QuickEditTestBase {
|
|||
);
|
||||
|
||||
// Create text format.
|
||||
$full_html_format = entity_create('filter_format', array(
|
||||
$full_html_format = FilterFormat::create(array(
|
||||
'format' => 'full_html',
|
||||
'name' => 'Full HTML',
|
||||
'weight' => 1,
|
||||
|
@ -95,14 +92,14 @@ 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.
|
||||
entity_create('filter_format', array(
|
||||
FilterFormat::create(array(
|
||||
'format' => 'no_editor',
|
||||
'name' => 'No Text Editor',
|
||||
'weight' => 2,
|
||||
|
@ -142,7 +139,7 @@ class QuickEditIntegrationTest extends QuickEditTestBase {
|
|||
$this->editorSelector = $this->container->get('quickedit.editor.selector');
|
||||
|
||||
// Create an entity with values for this text field.
|
||||
$entity = entity_create('entity_test');
|
||||
$entity = EntityTest::create();
|
||||
$entity->{$this->fieldName}->value = 'Hello, world!';
|
||||
$entity->{$this->fieldName}->format = 'filtered_html';
|
||||
$entity->save();
|
||||
|
@ -171,7 +168,7 @@ class QuickEditIntegrationTest extends QuickEditTestBase {
|
|||
$this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager);
|
||||
|
||||
// Create an entity with values for the field.
|
||||
$entity = entity_create('entity_test');
|
||||
$entity = EntityTest::create();
|
||||
$entity->{$this->fieldName}->value = 'Test';
|
||||
$entity->{$this->fieldName}->format = 'full_html';
|
||||
$entity->save();
|
||||
|
@ -208,7 +205,7 @@ class QuickEditIntegrationTest extends QuickEditTestBase {
|
|||
*/
|
||||
public function testGetUntransformedTextCommand() {
|
||||
// Create an entity with values for the field.
|
||||
$entity = entity_create('entity_test');
|
||||
$entity = EntityTest::create();
|
||||
$entity->{$this->fieldName}->value = 'Test';
|
||||
$entity->{$this->fieldName}->format = 'full_html';
|
||||
$entity->save();
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Tests\Update\EditorUpdateTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Tests\Update;
|
||||
|
||||
use Drupal\system\Tests\Update\UpdatePathTestBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor_test\EditorXssFilter\Insecure.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor_test\EditorXssFilter;
|
||||
|
||||
use Drupal\filter\FilterFormatInterface;
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor_test\Plugin\Editor\TRexEditor.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor_test\Plugin\Editor;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\editor\Plugin\EditorBase;
|
||||
use Drupal\editor\Entity\Editor as EditorEntity;
|
||||
|
||||
/**
|
||||
* Defines a Tyrannosaurus-Rex powered text editor for testing purposes.
|
||||
|
@ -37,7 +32,7 @@ class TRexEditor extends EditorBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function settingsForm(array $form, FormStateInterface $form_state, EditorEntity $editor) {
|
||||
public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
|
||||
$form['stumpy_arms'] = array(
|
||||
'#title' => t('Stumpy arms'),
|
||||
'#type' => 'checkbox',
|
||||
|
@ -49,7 +44,7 @@ class TRexEditor extends EditorBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getJSSettings(EditorEntity $editor) {
|
||||
public function getJSSettings(Editor $editor) {
|
||||
$js_settings = array();
|
||||
$settings = $editor->getSettings();
|
||||
if ($settings['stumpy_arms']) {
|
||||
|
@ -61,7 +56,7 @@ class TRexEditor extends EditorBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLibraries(EditorEntity $editor) {
|
||||
public function getLibraries(Editor $editor) {
|
||||
return array(
|
||||
'editor_test/trex',
|
||||
);
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor_test\Plugin\Editor\UnicornEditor.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor_test\Plugin\Editor;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\editor\Plugin\EditorBase;
|
||||
use Drupal\editor\Entity\Editor as EditorEntity;
|
||||
|
||||
/**
|
||||
* Defines a Unicorn-powered text editor for Drupal (for testing purposes).
|
||||
|
@ -38,7 +33,7 @@ class UnicornEditor extends EditorBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function settingsForm(array $form, FormStateInterface $form_state, EditorEntity $editor) {
|
||||
function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
|
||||
$form['ponies_too'] = array(
|
||||
'#title' => t('Pony mode'),
|
||||
'#type' => 'checkbox',
|
||||
|
@ -50,7 +45,7 @@ class UnicornEditor extends EditorBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function getJSSettings(EditorEntity $editor) {
|
||||
function getJSSettings(Editor $editor) {
|
||||
$js_settings = array();
|
||||
$settings = $editor->getSettings();
|
||||
if ($settings['ponies_too']) {
|
||||
|
@ -62,7 +57,7 @@ class UnicornEditor extends EditorBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLibraries(EditorEntity $editor) {
|
||||
public function getLibraries(Editor $editor) {
|
||||
return array(
|
||||
'editor_test/unicorn',
|
||||
);
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Tests\EditorFileReferenceFilterTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Tests;
|
||||
namespace Drupal\Tests\editor\Kernel;
|
||||
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\file\Entity\File;
|
||||
use Drupal\filter\FilterPluginCollection;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests Editor module's file reference filter.
|
||||
|
@ -55,14 +51,14 @@ class EditorFileReferenceFilterTest extends KernelTestBase {
|
|||
};
|
||||
|
||||
file_put_contents('public://llama.jpg', $this->randomMachineName());
|
||||
$image = entity_create('file', array('uri' => 'public://llama.jpg'));
|
||||
$image = File::create(['uri' => 'public://llama.jpg']);
|
||||
$image->save();
|
||||
$id = $image->id();
|
||||
$uuid = $image->uuid();
|
||||
$cache_tag = ['file:' . $id];
|
||||
|
||||
file_put_contents('public://alpaca.jpg', $this->randomMachineName());
|
||||
$image_2 = entity_create('file', array('uri' => 'public://alpaca.jpg'));
|
||||
$image_2 = File::create(['uri' => 'public://alpaca.jpg']);
|
||||
$image_2->save();
|
||||
$id_2 = $image_2->id();
|
||||
$uuid_2 = $image_2->uuid();
|
|
@ -1,22 +1,22 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Tests\EditorFileUsageTest.
|
||||
*/
|
||||
namespace Drupal\Tests\editor\Kernel;
|
||||
|
||||
namespace Drupal\editor\Tests;
|
||||
|
||||
use Drupal\system\Tests\Entity\EntityUnitTestBase;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\file\Entity\File;
|
||||
use Drupal\field\Entity\FieldStorageConfig;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
|
||||
/**
|
||||
* Tests tracking of file usage by the Text Editor module.
|
||||
*
|
||||
* @group editor
|
||||
*/
|
||||
class EditorFileUsageTest extends EntityUnitTestBase {
|
||||
class EditorFileUsageTest extends EntityKernelTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
|
@ -33,7 +33,7 @@ class EditorFileUsageTest extends EntityUnitTestBase {
|
|||
$this->installConfig(['node']);
|
||||
|
||||
// Add text formats.
|
||||
$filtered_html_format = entity_create('filter_format', array(
|
||||
$filtered_html_format = FilterFormat::create(array(
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'weight' => 0,
|
||||
|
@ -47,14 +47,14 @@ 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.
|
||||
$type = entity_create('node_type', array('type' => 'page', 'name' => 'page'));
|
||||
$type = NodeType::create(['type' => 'page', 'name' => 'page']);
|
||||
$type->save();
|
||||
node_add_body_field($type);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class EditorFileUsageTest extends EntityUnitTestBase {
|
|||
|
||||
$image_entities = array();
|
||||
foreach ($image_paths as $key => $image_path) {
|
||||
$image = entity_create('file');
|
||||
$image = File::create();
|
||||
$image->setFileUri($image_path);
|
||||
$image->setFilename(drupal_basename($image->getFileUri()));
|
||||
$image->save();
|
||||
|
@ -103,12 +103,12 @@ class EditorFileUsageTest extends EntityUnitTestBase {
|
|||
|
||||
// Test editor_entity_insert(): increment.
|
||||
$this->createUser();
|
||||
$node = entity_create('node', array(
|
||||
$node = $node = Node::create([
|
||||
'type' => 'page',
|
||||
'title' => 'test',
|
||||
'body' => $body,
|
||||
'uid' => 1,
|
||||
));
|
||||
]);
|
||||
$node->save();
|
||||
foreach ($image_entities as $key => $image_entity) {
|
||||
$this->assertIdentical(array('editor' => array('node' => array(1 => '1'))), $file_usage->listUsage($image_entity), 'The image ' . $image_paths[$key] . ' has 1 usage.');
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\editor\Kernel\EditorFilterIntegrationTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\editor\Kernel;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
|
|
|
@ -1,25 +1,20 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Tests\EditorImageDialogTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\editor\Tests;
|
||||
namespace Drupal\Tests\editor\Kernel;
|
||||
|
||||
use Drupal\Core\Form\FormState;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\editor\Form\EditorImageDialog;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\system\Tests\Entity\EntityUnitTestBase;
|
||||
|
||||
/**
|
||||
* Tests EditorImageDialog validation and conversion functionality.
|
||||
*
|
||||
* @group editor
|
||||
*/
|
||||
class EditorImageDialogTest extends EntityUnitTestBase {
|
||||
class EditorImageDialogTest extends EntityKernelTestBase {
|
||||
|
||||
/**
|
||||
* Filter format for testing.
|
||||
|
@ -41,7 +36,7 @@ class EditorImageDialogTest extends EntityUnitTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('file');
|
||||
$this->installSchema('system', ['router', 'key_value_expire']);
|
||||
$this->installSchema('system', ['key_value_expire']);
|
||||
$this->installSchema('node', array('node_access'));
|
||||
$this->installSchema('file', array('file_usage'));
|
||||
$this->installConfig(['node']);
|
|
@ -1,13 +1,10 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\editor\Tests\EditorManagerTest.
|
||||
*/
|
||||
namespace Drupal\Tests\editor\Kernel;
|
||||
|
||||
namespace Drupal\editor\Tests;
|
||||
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
use Drupal\editor\Entity\Editor;
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests detection of text editors and correct generation of attachments.
|
||||
|
@ -34,17 +31,16 @@ class EditorManagerTest extends KernelTestBase {
|
|||
parent::setUp();
|
||||
|
||||
// Install the Filter module.
|
||||
$this->installSchema('system', 'url_alias');
|
||||
|
||||
// Add text formats.
|
||||
$filtered_html_format = entity_create('filter_format', array(
|
||||
$filtered_html_format = FilterFormat::create(array(
|
||||
'format' => 'filtered_html',
|
||||
'name' => 'Filtered HTML',
|
||||
'weight' => 0,
|
||||
'filters' => array(),
|
||||
));
|
||||
$filtered_html_format->save();
|
||||
$full_html_format = entity_create('filter_format', array(
|
||||
$full_html_format = FilterFormat::create(array(
|
||||
'format' => 'full_html',
|
||||
'name' => 'Full HTML',
|
||||
'weight' => 1,
|
||||
|
@ -79,10 +75,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(
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\editor\Unit\EditorConfigEntityUnitTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\editor\Unit;
|
||||
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\editor\Unit\EditorXssFilter\StandardTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\editor\Unit\EditorXssFilter;
|
||||
|
||||
use Drupal\editor\EditorXssFilter\Standard;
|
||||
|
|
Reference in a new issue