diff --git a/core/modules/edit/edit.services.yml b/core/modules/edit/edit.services.yml index 91c37b1..46c8608 100644 --- a/core/modules/edit/edit.services.yml +++ b/core/modules/edit/edit.services.yml @@ -1,6 +1,6 @@ services: plugin.manager.edit.editor: - class: Drupal\edit\Plugin\EditorManager + class: Drupal\edit\Plugin\InPlaceEditorManager arguments: ['@container.namespaces'] access_check.edit.entity_field: class: Drupal\edit\Access\EditEntityFieldAccessCheck diff --git a/core/modules/edit/lib/Drupal/edit/Annotation/InPlaceEditor.php b/core/modules/edit/lib/Drupal/edit/Annotation/InPlaceEditor.php new file mode 100644 index 0000000..f3ea3e6 --- /dev/null +++ b/core/modules/edit/lib/Drupal/edit/Annotation/InPlaceEditor.php @@ -0,0 +1,48 @@ +discovery = new AnnotatedClassDiscovery('edit/editor', $namespaces); + $annotation_namespaces = array('Drupal\edit\Annotation' => $namespaces['Drupal\edit']); + $this->discovery = new AnnotatedClassDiscovery('InPlaceEditor', $namespaces, $annotation_namespaces, 'Drupal\edit\Annotation\InPlaceEditor'); $this->discovery = new ProcessDecorator($this->discovery, array($this, 'processDefinition')); $this->discovery = new AlterDecorator($this->discovery, 'edit_editor'); $this->discovery = new CacheDecorator($this->discovery, 'edit:editor'); diff --git a/core/modules/edit/lib/Drupal/edit/Tests/EditorSelectionTest.php b/core/modules/edit/lib/Drupal/edit/Tests/EditorSelectionTest.php index 26ec6c0..4ca8e36 100644 --- a/core/modules/edit/lib/Drupal/edit/Tests/EditorSelectionTest.php +++ b/core/modules/edit/lib/Drupal/edit/Tests/EditorSelectionTest.php @@ -7,7 +7,7 @@ namespace Drupal\edit\Tests; -use Drupal\edit\Plugin\EditorManager; +use Drupal\edit\Plugin\InPlaceEditorManager; use Drupal\edit\EditorSelector; /** diff --git a/core/modules/edit/lib/Drupal/edit/Tests/MetadataGeneratorTest.php b/core/modules/edit/lib/Drupal/edit/Tests/MetadataGeneratorTest.php index 6c4569f..a2b09ed 100644 --- a/core/modules/edit/lib/Drupal/edit/Tests/MetadataGeneratorTest.php +++ b/core/modules/edit/lib/Drupal/edit/Tests/MetadataGeneratorTest.php @@ -9,7 +9,7 @@ use Drupal\edit\EditorSelector; use Drupal\edit\MetadataGenerator; -use Drupal\edit\Plugin\EditorManager; +use Drupal\edit\Plugin\InPlaceEditorManager; use Drupal\edit_test\MockEditEntityFieldAccessCheck; /** diff --git a/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/edit/editor/WysiwygEditor.php b/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/InPlaceEditor/WysiwygEditor.php similarity index 89% rename from core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/edit/editor/WysiwygEditor.php rename to core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/InPlaceEditor/WysiwygEditor.php index e40e8b4..090e84f 100644 --- a/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/edit/editor/WysiwygEditor.php +++ b/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/InPlaceEditor/WysiwygEditor.php @@ -2,19 +2,19 @@ /** * @file - * Contains \Drupal\edit_test\Plugin\edit\editor\WysiwygEditor. + * Contains \Drupal\edit_test\Plugin\InPlaceEditor\WysiwygEditor. */ -namespace Drupal\edit_test\Plugin\edit\editor; +namespace Drupal\edit_test\Plugin\InPlaceEditor; use Drupal\edit\EditorBase; -use Drupal\Component\Annotation\Plugin; +use Drupal\edit\Annotation\InPlaceEditor; use Drupal\field\Plugin\Core\Entity\FieldInstance; /** * Defines the "wysiwyg" Create.js PropertyEditor widget. * - * @Plugin( + * @InPlaceEditor( * id = "wysiwyg", * jsClassName = "not needed for test", * alternativeTo = {"direct"}, diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php index b94d259..e1585be 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/EditorManager.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\editor\Plugin\EditorManager. + * Contains \Drupal\editor\Plugin\InPlaceEditorManager. */ namespace Drupal\editor\Plugin; diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/edit/editor/Editor.php b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php similarity index 92% rename from core/modules/editor/lib/Drupal/editor/Plugin/edit/editor/Editor.php rename to core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php index 81c23d7..d1eb344 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/edit/editor/Editor.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php @@ -2,22 +2,22 @@ /** * @file - * Contains \Drupal\editor\Plugin\edit\editor\Editor. + * Contains \Drupal\editor\Plugin\InPlaceEditor\Editor. */ -namespace Drupal\editor\Plugin\edit\editor; +namespace Drupal\editor\Plugin\InPlaceEditor; use Drupal\Component\Plugin\PluginBase; -use Drupal\Component\Annotation\Plugin; +use Drupal\edit\Annotation\InPlaceEditor; use Drupal\Core\Annotation\Translation; use Drupal\edit\EditPluginInterface; use Drupal\field\Plugin\Core\Entity\FieldInstance; /** - * Defines the "editor" Create.js PropertyEditor widget. + * Defines the "editor" Create.js InPlaceEditor widget. * - * @Plugin( - * id = "editor", + * @InPlaceEditor( + * id = "in_place_editor", * jsClassName = "editor", * alternativeTo = {"direct"}, * module = "editor" diff --git a/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php index 1dcadc8..9d585bf 100644 --- a/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php +++ b/core/modules/editor/lib/Drupal/editor/Tests/EditIntegrationTest.php @@ -9,7 +9,7 @@ use Drupal\edit\EditorSelector; use Drupal\edit\MetadataGenerator; -use Drupal\edit\Plugin\EditorManager; +use Drupal\edit\Plugin\InPlaceEditorManager; use Drupal\edit\Tests\EditTestBase; use Drupal\edit_test\MockEditEntityFieldAccessCheck; use Drupal\editor\EditorController; @@ -122,7 +122,7 @@ protected function getSelectedEditor($items, $field_name, $view_mode = 'default' * format compatibility. */ function testEditorSelection() { - $this->editorManager = new EditorManager($this->container->get('container.namespaces')); + $this->editorManager = new InPlaceEditorManager($this->container->get('container.namespaces')); $this->editorSelector = new EditorSelector($this->editorManager); // Pretend there is an entity with these items for the field. @@ -133,7 +133,7 @@ function testEditorSelection() { // Editor selection w/ cardinality 1, text format w/ associated text editor. $items[0]['format'] = 'full_html'; - $this->assertEqual('editor', $this->getSelectedEditor($items, $this->field_name), "With cardinality 1, and the full_html text format, the 'editor' editor is selected."); + $this->assertEqual('in_place_editor', $this->getSelectedEditor($items, $this->field_name), "With cardinality 1, and the full_html text format, the 'editor' editor is selected."); // Editor selection with text processing, cardinality >1 $this->field_textarea_field['cardinality'] = 2; @@ -146,7 +146,7 @@ function testEditorSelection() { * Tests (custom) metadata when the "Editor" Create.js editor is used. */ function testMetadata() { - $this->editorManager = new EditorManager($this->container->get('container.namespaces')); + $this->editorManager = new InPlaceEditorManager($this->container->get('container.namespaces')); $this->accessChecker = new MockEditEntityFieldAccessCheck(); $this->editorSelector = new EditorSelector($this->editorManager); $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager); @@ -164,7 +164,7 @@ function testMetadata() { $expected = array( 'access' => TRUE, 'label' => 'Long text field', - 'editor' => 'editor', + 'editor' => 'in_place_editor', 'aria' => 'Entity entity_test 1, field Long text field', 'custom' => array( 'format' => 'full_html',