You are here

class UploadImage in CKEditor Upload Image 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/CKEditorPlugin/UploadImage.php \Drupal\ckeditor_uploadimage\Plugin\CKEditorPlugin\UploadImage

Defines the "templates" plugin.

Plugin annotation


@CKEditorPlugin(
  id = "uploadimage",
  label = @Translation("CKEditor Upload Image"),
  module = "ckeditor_uploadimage"
)

Hierarchy

Expanded class hierarchy of UploadImage

File

src/Plugin/CKEditorPlugin/UploadImage.php, line 23
Contains \Drupal\ckeditor_uploadimage\Plugin\CKEditorPlugin\UploadImage.

Namespace

Drupal\ckeditor_uploadimage\Plugin\CKEditorPlugin
View source
class UploadImage extends PluginBase implements CKEditorPluginInterface {

  /**
   * {@inheritdoc}
   */
  function getDependencies(Editor $editor) {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  function getFile() {
    $path = 'libraries/ckeditor/plugins/' . $this
      ->getPluginId() . '/plugin.js';
    if (file_exists('profiles/' . drupal_get_profile() . "/{$path}")) {
      return 'profiles/' . drupal_get_profile() . "/{$path}";
    }
    return $path;
  }

  /**
   * {@inheritdoc}
   */
  function isInternal() {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function getConfig(Editor $editor) {
    $filterFormatId = $editor
      ->getFilterFormat()
      ->id();
    return [
      'imageUploadUrl' => Url::fromRoute('ckeditor_uploadimage.save', [
        'filterFormatId' => $filterFormatId,
      ])
        ->toString(),
    ];
  }

  /**
   * {@inheritdoc}
   */
  function getLibraries(Editor $editor) {
    return [];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 92
UploadImage::getConfig public function Returns the additions to CKEDITOR.config for a specific CKEditor instance. Overrides CKEditorPluginInterface::getConfig
UploadImage::getDependencies function Returns a list of plugins this plugin requires. Overrides CKEditorPluginInterface::getDependencies
UploadImage::getFile function Returns the Drupal root-relative file path to the plugin JavaScript file. Overrides CKEditorPluginInterface::getFile
UploadImage::getLibraries function Returns a list of libraries this plugin requires. Overrides CKEditorPluginInterface::getLibraries
UploadImage::isInternal function Indicates if this plugin is part of the optimized CKEditor build. Overrides CKEditorPluginInterface::isInternal