Last active
August 9, 2018 17:17
-
-
Save alexfinnarn/116616247914bea5027f2742311975b3 to your computer and use it in GitHub Desktop.
no page_alter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_page_alter(). | |
*/ | |
function code_syntax_highlighting_bundle_page_alter() { | |
// Add the JS and CSS assets if the page is supposed to have code syntax highlighting. | |
$current_object = menu_get_object(); | |
if (in_array($current_object->type, config_get('code_syntax_highlighting_bundle.settings','csh_enabled_node_types'), TRUE)) { | |
backdrop_add_css(backdrop_get_path('module', 'code_syntax_highlighting_bundle') | |
. '/libraries/highlightjs/styles/' . config_get('code_syntax_highlighting_bundle.settings','csh_theme') . '.css'); | |
backdrop_add_css(backdrop_get_path('module', 'code_syntax_highlighting_bundle') | |
. '/css/csh.css'); | |
// @todo Update the library and provide instructions to override the custom packaged build. | |
backdrop_add_js(backdrop_get_path('module', 'code_syntax_highlighting_bundle') | |
. '/libraries/highlightjs/highlight.pack.js'); | |
backdrop_add_js('jQuery(document).ready(function () { hljs.initHighlightingOnLoad(); });', array( | |
'type' => 'inline', | |
'scope' => 'footer', | |
)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment