You are here

OnomasticonExcludeCkeditorButton.php in Onomasticon 2.x

Same filename and directory in other branches
  1. 8 src/Plugin/CKEditorPlugin/OnomasticonExcludeCkeditorButton.php

File

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

namespace Drupal\onomasticon\Plugin\CKEditorPlugin;

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

/**
 * Defines the Onomasticon Exclude (Nonomasticon) 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 = "nonomasticon",
 *   label = @Translation("Nonomasticon")
 * )
 */
class OnomasticonExcludeCkeditorButton 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', 'onomasticon') . '/js/plugins/nonomasticon';
    return [
      'nonomasticon' => [
        'label' => $this
          ->t('NOnomasticon'),
        'image' => $path . '/icons/nonomasticon.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', 'onomasticon') . '/js/plugins/nonomasticon/plugin.js';
  }

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

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

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

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

}

Classes

Namesort descending Description
OnomasticonExcludeCkeditorButton Defines the Onomasticon Exclude (Nonomasticon) plugin.