You are here

ckeditor_abbreviation.module in CKEditor Abbreviation 7

Same filename and directory in other branches
  1. 8 ckeditor_abbreviation.module
  2. 2.0.x ckeditor_abbreviation.module

CKEditor abbreviation button.

File

ckeditor_abbreviation.module
View source
<?php

/**
 * @file
 * CKEditor abbreviation button.
 */

/**
 * Implements hook_help().
 */
function ckeditor_abbreviation_help($path, $arg) {
  switch ($path) {
    case 'admin/help#ckeditor_abbreviation':
      $output = '';
      $output .= '<h3>' . t('CKEditor Abbreviation Button') . '</h3>';
      $output .= '<p>' . t('The module adds a CKEditor (WYSIWYG HTML editor) abbreviation button to the editor toolbar and a link to its context menu (only available if you select an existing abbr tag in the editor content).') . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Settings') . '</dt>';
      $output .= '<dd>' . t('In the <a href="@ckeditor-settings">ckeditor profiles</a> under <em>Editor appearance</em> move the icon into the toolbar and check the plugin in the <em>Plugins</em> section.', array(
        '@ckeditor-settings' => url('admin/config/content/ckeditor'),
      )) . '</dd>';
      $output .= '<dd>' . t('If your <a href="@text-formats">text formats</a> that use ckeditor limit the allowed HTML tags, add "&lt;abbr&gt;" to the allowed tags.', array(
        '@text-formats' => url('admin/config/content/formats'),
      )) . '</dd>';
      $output .= '</dl>';
      return $output;
  }
}

/**
 * Implements hook_ckeditor_plugin().
 */
function ckeditor_abbreviation_ckeditor_plugin() {
  $module_path = drupal_get_path('module', 'ckeditor_abbreviation');
  $plugins = array();
  $plugins['abbr'] = array(
    'name' => 'abbr',
    // as in plugin.js CKEDITOR.plugins.add('NAME')
    'desc' => t('Plugin to insert and edit abbreviations'),
    'path' => $module_path . '/plugins/abbr/',
    'buttons' => array(
      'abbr' => array(
        // as in plugin.js ui.addButton('BUTTON-NAME')
        'icon' => 'icons/abbr.png',
        'label' => 'Insert Abbreviation',
      ),
    ),
  );
  return $plugins;
}