Skip to content

Instantly share code, notes, and snippets.

@alexfinnarn
Last active August 8, 2018 20:54
Show Gist options
  • Save alexfinnarn/f77917583282c791eb5e518382b959fd to your computer and use it in GitHub Desktop.
Save alexfinnarn/f77917583282c791eb5e518382b959fd to your computer and use it in GitHub Desktop.
WYSIWYG to CKEdtior hooks
<?php
/**
* Implements of hook_wysiwyg_plugin().
*/
function code_syntax_highlighting_bundle_wysiwyg_plugin($editor, $version) {
// Add the code button for the ckeditor.
if ($editor === 'ckeditor') {
return array(
'code_sc' => array(
'path' => backdrop_get_path('module', 'code_syntax_highlighting_bundle') . '/plugins/code_sc',
'buttons' => array(
'code_sc_button' => t('Code Shortcode Generator'),
),
'load' => TRUE,
),
);
}
}
/**
* Implements hook_ckeditor_plugins().
*/
function code_syntax_highlighting_bundle_ckeditor_plugins() {
$plugins['csh'] = array(
'path' => backdrop_get_path('module', 'code_syntax_highlighting_bundle') . '/plugins/code_sc',
'file' => 'plugin.js',
'internal' => FALSE,
// 'css' => array(backdrop_get_path('module', 'mymodule') . '/css/myplugin.css'),
'enabled callback' => 'csh_plugin_check',
'buttons' => array(
'CSH' => array(
'label' => t('Code Syntax Highlighting'),
'image' => backdrop_get_path('module', 'code_syntax_highlighting_bundle') . '/plugins/code_sc/images/code_sc_button.png',
'image_alternative' =>'{code}',
//'dependencies' => array('contextmenu'),
),
),
);
return $plugins;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment