/block_my_plugin.php
<?php class block_my_plugin extends block_base { public function init() { $this->title = get_string('my_plugin', 'block_my_plugin'); } public function get_content() { global $USER, $COURSE, $PAGE, $OUTPUT; $PAGE->requires->js('/blocks/my_plugin/lib/d3.v2.min.js'); $PAGE->requires->js_call_amd( 'block_my_plugin/my_plugin', 'init', array( $USER, $COURSE ) ); $this->content->text = $OUTPUT->render_from_template('block_my_plugin/my_plugin', new stdClass()); return $this->content; } }