ckeditor5-1.0.x-dev/src/Plugin/CKEditor5Plugin/Media.php

src/Plugin/CKEditor5Plugin/Media.php
<?php

namespace Drupal\ckeditor5\Plugin\CKEditor5Plugin;

use Drupal\ckeditor5\Plugin\CKEditor5PluginDefault;
use Drupal\Core\Url;
use Drupal\editor\Entity\Editor;

/**
 * CKEditor5 Media plugin.
 *
 * Provides drupal-media element and options provided by the CKEditor5 build.
 */
class Media extends CKEditor5PluginDefault {

  /**
   * {@inheritdoc}
   */
  public function getDynamicPluginConfig(array $static_plugin_config, Editor $editor) {
    $config = $static_plugin_config;
    $config['drupalMedia']['previewURL'] = Url::fromRoute('media.filter.preview')
      ->setRouteParameter('filter_format', $editor->getFilterFormat()->id())
      ->toString(TRUE)
      ->getGeneratedUrl();
    $config['drupalMedia']['isMediaUrl'] = Url::fromRoute('ckeditor5.media_image')
      ->setRouteParameter('editor', $editor->id())
      ->toString(TRUE)
      ->getGeneratedUrl();

    return $config;
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc