Commit a7090c15 authored by catch's avatar catch
Browse files

feat: #3317769 Add support for linking to entities in CKEditor 5

parent f548a439
Loading
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -12085,6 +12085,12 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/ckeditor5/src/Plugin/CKEditor5Plugin/CodeBlock.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\ckeditor5\\\\Plugin\\\\CKEditor5Plugin\\\\EntityLinkSuggestions\\:\\:setConfiguration\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/ckeditor5/src/Plugin/CKEditor5Plugin/EntityLinkSuggestions.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\ckeditor5\\\\Plugin\\\\CKEditor5Plugin\\\\Heading\\:\\:setConfiguration\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -17871,6 +17877,18 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/filter/tests/src/Functional/Rest/FilterFormatXmlBasicAuthTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\filter\\\\Kernel\\\\EntityLinksTest\\:\\:assertPathAliasExists\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/filter/tests/src/Kernel/EntityLinksTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\filter\\\\Kernel\\\\EntityLinksTest\\:\\:assertPathAliasNotExists\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/filter/tests/src/Kernel/EntityLinksTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\filter\\\\Kernel\\\\TextFormatElementFormTest\\:\\:submitForm\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
+25 −0
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

namespace Drupal\Core\Entity;

use Drupal\Core\GeneratedUrl;

/**
 * Provides an interface for generating a link target from an entity.
 */
interface EntityLinkTargetInterface {

  /**
   * Gets the generated URL object for a linked entity's link target.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   A linked entity.
   *
   * @return \Drupal\Core\GeneratedUrl
   *   The generated URL plus cacheability metadata.
   */
  public function getLinkTarget(EntityInterface $entity): GeneratedUrl;

}
+6 −0
Original line number Diff line number Diff line
@@ -441,6 +441,12 @@
 *   - delete-form: Confirmation form to delete the entity.
 *   - edit-form: Editing form.
 *   - Other link types specific to your entity type can also be defined.
 * - If linking to entities of your content entity type should happen with URLs
 *   other than the canonical one, or if it does not have a route where it can
 *   be viewed, then a link_target handler should be implemented. At minimum,
 *   provide a link_target.view handler: a class implementing
 *   \Drupal\Core\Entity\EntityLinkTargetInterface. Optionally, if the content
 *   entity type is downloadable, also provide a link_target.download handler.
 * - If your content entity is fieldable, provide the 'field_ui_base_route'
 *   annotation property, giving the name of the route that the Manage Fields,
 *   Manage Display, and Manage Form Display pages from the Field UI module
+41 −0
Original line number Diff line number Diff line
@@ -355,6 +355,21 @@ ckeditor5_link:
      - <a>
      - <a href>

ckeditor5_link_entity_suggestions:
  ckeditor5:
    plugins:
      - drupalEntityLinkSuggestions.DrupalEntityLinkSuggestions
  drupal:
    label: Entity links
    class: \Drupal\ckeditor5\Plugin\CKEditor5Plugin\EntityLinkSuggestions
    library: ckeditor5/internal.drupal.ckeditor5.link-entity-suggestions
    elements:
      - <a data-entity-type data-entity-uuid data-entity-metadata>
    conditions:
      filter: entity_links
      plugins:
        - ckeditor5_link

ckeditor5_linkImage:
  ckeditor5:
    plugins:
@@ -373,6 +388,18 @@ ckeditor5_linkImage:
        - ckeditor5_link
        - ckeditor5_image

ckeditor5_entityLinkImage:
  ckeditor5:
    plugins: []
  drupal:
    label: Entity-Linked Image
    elements:
      - <img data-link-entity-type data-link-entity-uuid>
    conditions:
      plugins:
        - ckeditor5_link_entity_suggestions
        - ckeditor5_image

ckeditor5_linkMedia:
  ckeditor5:
    plugins:
@@ -834,3 +861,17 @@ media_library_mediaLibrary:
    conditions:
      filter: media_embed
      toolbarItem: drupalMedia

ckeditor5_entityLinkMedia:
  ckeditor5:
    plugins: []
  drupal:
    label: Entity-Linked Media
    elements:
      # The drupalMedia.DrupalLinkMedia CKEditor 5 plugin automatically supports the
      # Entity Link Suggestions functionality when it is enabled.
      - <drupal-media data-link-entity-type data-link-entity-uuid data-link-entity-metadata>
    conditions:
      plugins:
        - ckeditor5_link_entity_suggestions
        - media_media
+11 −0
Original line number Diff line number Diff line
@@ -73,6 +73,17 @@ internal.drupal.ckeditor5.emphasis:
    - core/ckeditor5
    - core/ckeditor5.basic

internal.drupal.ckeditor5.link-entity-suggestions:
  js:
    js/build/drupalEntityLinkSuggestions.js: { minified: true }
  css:
    component:
      css/entity-link-suggestions.css: {}
  dependencies:
    - core/ckeditor5
    - core/drupal
    - core/drupal.autocomplete

internal.drupal.ckeditor5.media:
  js:
    js/build/drupalMedia.js: { minified: true }
Loading