Skip to content

Instantly share code, notes, and snippets.

@jorislucius
Created June 17, 2019 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorislucius/0286fe4bcdbc89bf580f0f4c53c228d3 to your computer and use it in GitHub Desktop.
Save jorislucius/0286fe4bcdbc89bf580f0f4c53c228d3 to your computer and use it in GitHub Desktop.
<?php
/**
* Render.
*
* @param $course_code
*
* @return array
* Returns a renderable array.
*/
public function render($course_code) {
return [
'#type' => 'markup',
'#markup' => '<div id="root"></div>',
'#attached' => [
'drupalSettings' => [
'course_code' => $course_code,
],
'library' => [
'YOURLIBRARY.NAME',
],
],
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment