You are here

Quote.php in CKEditor Quote 8

File

src/Plugin/CKEditorPlugin/Quote.php
View source
<?php

namespace Drupal\ckeditor_quote\Plugin\CKEditorPlugin;

use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\editor\Entity\Editor;

/**
 * Defines the "quote" plugin.
 *
 * NOTE: The plugin ID ('id' key) corresponds to the CKEditor plugin name.
 * It is the first argument of the CKEDITOR.plugins.add() function in the
 * plugin.js file.
 *
 * @CKEditorPlugin(
 *   id = "quote",
 *   label = @Translation("Quote")
 * )
 */
class Quote extends CKEditorPluginBase {

  /**
   * {@inheritdoc}
   *
   * NOTE: The keys of the returned array corresponds to the CKEditor button
   * names. They are the first argument of the editor.ui.addButton() or
   * editor.ui.addRichCombo() functions in the plugin.js file.
   */
  public function getButtons() {

    // Make sure that the path to the image matches the file structure of
    // the CKEditor plugin you are implementing.
    $path = drupal_get_path('module', 'ckeditor_quote') . '/js/plugins/quote';
    return array(
      'quote' => array(
        'label' => t('Quote'),
        'image' => $path . '/icons/quote.png',
      ),
    );
  }

  /**
   * {@inheritdoc}
   */
  public function getFile() {

    // Make sure that the path to the plugin.js matches the file structure of
    // the CKEditor plugin you are implementing.
    return drupal_get_path('module', 'ckeditor_quote') . '/js/plugins/quote/plugin.js';
  }

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

}

Classes

Namesort descending Description
Quote Defines the "quote" plugin.