Created
December 13, 2013 11:03
-
-
Save sonicpunk/7942772 to your computer and use it in GitHub Desktop.
Allows you to send a link to your javascript to the bottom of the page. Example call would be [[!sendJsBottom? &link=`/assets/js/scriptname.js`]].
With this snippet you can place it into a chunk that may contain elements for a component.
This file contains hidden or 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 | |
$link = $modx->getOption('link',$scriptProperties,''); | |
// For debugging: | |
$modx->log(modX::LOG_LEVEL_DEBUG | |
, '[sendJsBottom] called on page '. $modx->resource->id . ' with the following properties: ' | |
.print_r($scriptProperties, true)); | |
// Verify Inputs | |
if(isset($scriptProperties['link'])){ | |
$modx->regClientScript($link); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment