original_string: public function js_call_amd($fullmodule, $func = null, $params = array()) {
          global $CFG;
  
          list($component, $module) = explode('/', $fullmodule, 2);
  
          $component = clean_param($component, PARAM_COMPONENT);
          $module = clean_param($module, PARAM_ALPHANUMEXT);
  
          if ($func !== null) {
              $func = clean_param($func, PARAM_ALPHANUMEXT);
  
              $jsonparams = array();
              foreach ($params as $param) {
                  $jsonparams[] = json_encode($param);
              }
              $strparams = implode(', ', $jsonparams);
              if ($CFG->debugdeveloper) {
                  $toomanyparamslimit = 1024;
                  if (strlen($strparams) > $toomanyparamslimit) {
                      debugging('Too much data passed as arguments to js_call_amd("' . $fullmodule . '", "' . $func .
                          '"). Generally there are better ways to pass lots of data from PHP to JavaScript, for example via Ajax, ' .
                          'data attributes, ... . This warning is triggered if the argument string becomes longer than ' .
                          $toomanyparamslimit . ' characters.', DEBUG_DEVELOPER);
                  }
              }
  
              $js = 'require(["' . $component . '/' . $module . '"], function(amd) { amd.' . $func . '(' . $strparams . '); });';
  
          } else {
              $js = 'require(["' . $component . '/' . $module . '"]);';
          }
  
          $this->js_amd_inline($js);
      }
code: public function js_call_amd($fullmodule, $func = null, $params = array()) {
          global $CFG;
  
          list($component, $module) = explode('/', $fullmodule, 2);
  
          $component = clean_param($component, PARAM_COMPONENT);
          $module = clean_param($module, PARAM_ALPHANUMEXT);
  
          if ($func !== null) {
              $func = clean_param($func, PARAM_ALPHANUMEXT);
  
              $jsonparams = array();
              foreach ($params as $param) {
                  $jsonparams[] = json_encode($param);
              }
              $strparams = implode(', ', $jsonparams);
              if ($CFG->debugdeveloper) {
                  $toomanyparamslimit = 1024;
                  if (strlen($strparams) > $toomanyparamslimit) {
                      debugging('Too much data passed as arguments to js_call_amd("' . $fullmodule . '", "' . $func .
                          '"). Generally there are better ways to pass lots of data from PHP to JavaScript, for example via Ajax, ' .
                          'data attributes, ... . This warning is triggered if the argument string becomes longer than ' .
                          $toomanyparamslimit . ' characters.', DEBUG_DEVELOPER);
                  }
              }
  
              $js = 'require(["' . $component . '/' . $module . '"], function(amd) { amd.' . $func . '(' . $strparams . '); });';
  
          } else {
              $js = 'require(["' . $component . '/' . $module . '"]);';
          }
  
          $this->js_amd_inline($js);
      }
code_tokens: public function js_call_amd ( $ fullmodule , $ func = null , $ params = array ( ) ) { global $ CFG ; list ( $ component , $ module ) = explode ( '/' , $ fullmodule , 2 ) ; $ component = clean_param ( $ component , PARAM_COMPONENT ) ; $ module = clean_param ( $ module , PARAM_ALPHANUMEXT ) ; if ( $ func !== null ) { $ func = clean_param ( $ func , PARAM_ALPHANUMEXT ) ; $ jsonparams = array ( ) ; foreach ( $ params as $ param ) { $ jsonparams [ ] = json_encode ( $ param ) ; } $ strparams = implode ( ', ' , $ jsonparams ) ; if ( $ CFG -> debugdeveloper ) { $ toomanyparamslimit = 1024 ; if ( strlen ( $ strparams ) > $ toomanyparamslimit ) { debugging ( 'Too much data passed as arguments to js_call_amd("' . $ fullmodule . '", "' . $ func . '"). Generally there are better ways to pass lots of data from PHP to JavaScript, for example via Ajax, ' . 'data attributes, ... . This warning is triggered if the argument string becomes longer than ' . $ toomanyparamslimit . ' characters.' , DEBUG_DEVELOPER ) ; } } $ js = 'require(["' . $ component . '/' . $ module . '"], function(amd) { amd.' . $ func . '(' . $ strparams . '); });' ; } else { $ js = 'require(["' . $ component . '/' . $ module . '"]);' ; } $ this -> js_amd_inline ( $ js ) ; }
docstring: Load an AMD module and eventually call its method.
  
  This function creates a minimal inline JS snippet that requires an AMD module and eventually calls a single
  function from the module with given arguments. If it is called multiple times, it will be create multiple
  snippets.
  
  @param string $fullmodule The name of the AMD module to load, formatted as <component name>/<module name>.
  @param string $func Optional function from the module to call, defaults to just loading the AMD module.
  @param array $params The params to pass to the function (will be serialized into JSON).
docstring_tokens: Load an AMD module and eventually call its method .