function editor_ckeditor_editor_ckeditor_plugins in Editor 7
Implements hook_editor_ckeditor_plugins().
File
- modules/
editor_ckeditor/ editor_ckeditor.editor_ckeditor.inc, line 11 - Editor CKEditor hooks implemented by the Editor CKEditor module.
Code
function editor_ckeditor_editor_ckeditor_plugins() {
$image_prefix = drupal_get_path('module', 'editor_ckeditor') . '/images/buttons/';
$buttons = array(
'Bold' => array(
'label' => t('Bold'),
'required_html' => array(
array(
'tags' => array(
'strong',
),
),
),
),
'Italic' => array(
'label' => t('Italic'),
'required_html' => array(
array(
'tags' => array(
'em',
),
),
),
),
'Underline' => array(
'label' => t('Underline'),
// A class is used on spans for underline.
'required_html' => array(
array(
'tags' => array(
'span',
),
),
),
),
'Strike' => array(
'label' => t('Strike-through'),
'required_html' => array(
array(
'tags' => array(
'del',
),
),
),
),
'JustifyLeft' => array(
'label' => t('Align left'),
'required_html' => array(
array(
'tags' => array(
'p',
),
'classes' => array(
'text-align-left',
),
),
),
),
'JustifyCenter' => array(
'label' => t('Align center'),
'required_html' => array(
array(
'tags' => array(
'p',
),
'classes' => array(
'text-align-center',
),
),
),
),
'JustifyRight' => array(
'label' => t('Align right'),
'required_html' => array(
array(
'tags' => array(
'p',
),
'classes' => array(
'text-align-right',
),
),
),
),
'JustifyBlock' => array(
'label' => t('Justify'),
'required_html' => array(
array(
'tags' => array(
'p',
),
'classes' => array(
'text-align-justify',
),
),
),
),
'BulletedList' => array(
'label' => t('Bullet list'),
'image_rtl' => $image_prefix . '/bulletedlist-rtl.png',
'required_html' => array(
array(
'tags' => array(
'ul',
'li',
),
),
),
),
'NumberedList' => array(
'label' => t('Numbered list'),
'image_rtl' => $image_prefix . '/numberedlist-rtl.png',
'required_html' => array(
array(
'tags' => array(
'ol',
'li',
),
),
),
),
'Undo' => array(
'label' => t('Undo'),
'image_rtl' => $image_prefix . '/undo-rtl.png',
),
'Redo' => array(
'label' => t('Redo'),
'image_rtl' => $image_prefix . '/redo-rtl.png',
),
'Anchor' => array(
'image_rtl' => $image_prefix . '/anchor-rtl.png',
'label' => t('Anchor'),
'required_html' => array(
array(
'tags' => array(
'a',
),
'attributes' => array(
'href',
'title',
'name',
'id',
),
),
),
),
'Superscript' => array(
'label' => t('Superscript'),
'required_html' => array(
array(
'tags' => array(
'sup',
),
),
),
),
'Subscript' => array(
'label' => t('Subscript'),
'required_html' => array(
array(
'tags' => array(
'sub',
),
),
),
),
'Blockquote' => array(
'label' => t('Blockquote'),
'required_html' => array(
array(
'tags' => array(
'blockquote',
),
),
),
),
'Source' => array(
'label' => t('Source code'),
),
'HorizontalRule' => array(
'label' => t('Horizontal rule'),
'required_html' => array(
array(
'tags' => array(
'hr',
),
),
),
),
'Cut' => array(
'label' => t('Cut'),
),
'Copy' => array(
'label' => t('Copy'),
),
'Paste' => array(
'label' => t('Paste'),
),
'PasteText' => array(
'label' => t('Paste Text'),
'image_rtl' => $image_prefix . '/pastetext-rtl.png',
),
'PasteFromWord' => array(
'label' => t('Paste from Word'),
'image_rtl' => $image_prefix . '/pastefromword-rtl.png',
),
'ShowBlocks' => array(
'label' => t('Show blocks'),
'image_rtl' => $image_prefix . '/showblocks-rtl.png',
),
'RemoveFormat' => array(
'label' => t('Remove format'),
),
'SpecialChar' => array(
'label' => t('Character map'),
),
'Format' => array(
'label' => t('HTML block format'),
'image_alternative' => '<span class="ckeditor-button-dropdown">' . t('Format') . '<span class="ckeditor-button-arrow"></span></span>',
),
'Styles' => array(
'label' => t('Font style'),
'image_alternative' => '<span class="ckeditor-button-dropdown">' . t('Styles') . '<span class="ckeditor-button-arrow"></span></span>',
),
'Table' => array(
'label' => t('Table'),
'required_html' => array(
array(
'tags' => array(
'table',
'thead',
'tbody',
'tr',
'td',
'th',
),
),
),
),
'Maximize' => array(
'label' => t('Maximize'),
),
'Language' => array(
'label' => t('Language'),
),
'-' => array(
'label' => t('Separator'),
'image_alternative' => '<span class="ckeditor-separator" title="' . t('Button separator') . '" aria-label="' . t('Button separator') . '"> </span>',
'attributes' => array(
'class' => array(
'ckeditor-button-separator',
),
),
'multiple' => TRUE,
),
);
// Populate image locations that match button names.
foreach ($buttons as $button_name => &$button) {
if (!isset($button['image_alternative']) && !isset($button['image'])) {
// Because button names are ASCII text, drupal_strtolower() is not needed.
$button['image'] = $image_prefix . strtolower($button_name) . '.png';
}
}
// List all the basic plugin buttons as an "internal" plugin.
$plugins['default'] = array(
'buttons' => $buttons,
'internal' => TRUE,
);
// The drupalimage plugin replaces normal image functionality.
$plugins['drupalimage'] = array(
'path' => drupal_get_path('module', 'editor_ckeditor') . '/js/plugins/drupalimage',
'file' => 'plugin.js',
'buttons' => array(
'DrupalImage' => array(
'label' => t('Image'),
'required_html' => array(
array(
'tags' => array(
'img',
),
'attributes' => array(
'src',
'alt',
'data-entity-type',
'data-entity-id',
'data-align',
),
),
),
'image' => drupal_get_path('module', 'editor_ckeditor') . '/js/plugins/drupalimage/icons/drupalimage.png',
),
),
);
// The drupalcaption plugin provides consistent behaviors for image captions.
$plugins['drupalimagecaption'] = array(
'path' => drupal_get_path('module', 'editor_ckeditor') . '/js/plugins/drupalimagecaption',
'file' => 'plugin.js',
'enabled callback' => 'editor_ckeditor_image_plugin_check',
'required_html' => array(
array(
'tags' => array(
'img',
),
'attributes' => array(
'data-caption',
),
),
array(
'tags' => array(
'figure',
'figcaption',
),
'attributes' => array(
'src',
'alt',
'class',
'data-placeholder',
),
),
),
);
// The drupallink plugin replaces normal link functionality.
$plugins['drupallink'] = array(
'path' => drupal_get_path('module', 'editor_ckeditor') . '/js/plugins/drupallink',
'file' => 'plugin.js',
'buttons' => array(
'DrupalLink' => array(
'label' => t('Link'),
'required_html' => array(
array(
'tags' => array(
'a',
),
'attributes' => array(
'href',
),
),
),
'image' => drupal_get_path('module', 'editor_ckeditor') . '/js/plugins/drupallink/icons/drupallink.png',
),
'DrupalUnlink' => array(
'label' => t('Link'),
'required_html' => array(
array(
'tags' => array(
'a',
),
'attributes' => array(
'href',
),
),
),
'image' => drupal_get_path('module', 'editor_ckeditor') . '/js/plugins/drupallink/icons/drupalunlink.png',
),
),
);
return $plugins;
}