source/Core/ViewHelper/JavaScriptRenderer.php
protected function formFilesOutput($includes, $widget)
    {
        if (!count($includes)) {
            return '';
        }

        ksort($includes); // Sort by priority.
        $usedSources = [];
        $widgets = [];
        $widgetTemplate = "WidgetsHandler.registerFile('%s', '%s');";
        $scriptTemplate = '<script type="text/javascript" src="%s"></script>';
        foreach ($includes as $priority) {
            foreach ($priority as $source) {
                if (!in_array($source, $usedSources)) {
                    $widgets[] = sprintf(($widget ? $widgetTemplate : $scriptTemplate), $source, $widget);
                    $usedSources[] = $source;
                }
            }
        }
        $output = implode(PHP_EOL, $widgets);
        if ($widget && !empty($output)) {
            $output = <<<JS
<script type='text/javascript'>
    window.addEventListener('load', function() {
        $output
    }, false)
</script>
JS;
        }

        return $output;
    }
protected function formFilesOutput($includes, $widget)
    {
        if (!count($includes)) {
            return '';
        }

        ksort($includes); // Sort by priority.
        $usedSources = [];
        $widgets = [];
        $widgetTemplate = "WidgetsHandler.registerFile('%s', '%s');";
        $scriptTemplate = '<script type="text/javascript" src="%s"></script>';
        foreach ($includes as $priority) {
            foreach ($priority as $source) {
                if (!in_array($source, $usedSources)) {
                    $widgets[] = sprintf(($widget ? $widgetTemplate : $scriptTemplate), $source, $widget);
                    $usedSources[] = $source;
                }
            }
        }
        $output = implode(PHP_EOL, $widgets);
        if ($widget && !empty($output)) {
            $output = <<<JS
<script type='text/javascript'>
    window.addEventListener('load', function() {
        $output
    }, false)
</script>
JS;
        }

        return $output;
    }
protected function formFilesOutput ( $ includes , $ widget ) { if ( ! count ( $ includes ) ) { return '' ; } ksort ( $ includes ) ; // Sort by priority. $ usedSources = [ ] ; $ widgets = [ ] ; $ widgetTemplate = "WidgetsHandler.registerFile('%s', '%s');" ; $ scriptTemplate = '<script type="text/javascript" src="%s"></script>' ; foreach ( $ includes as $ priority ) { foreach ( $ priority as $ source ) { if ( ! in_array ( $ source , $ usedSources ) ) { $ widgets [ ] = sprintf ( ( $ widget ? $ widgetTemplate : $ scriptTemplate ) , $ source , $ widget ) ; $ usedSources [ ] = $ source ; } } } $ output = implode ( PHP_EOL , $ widgets ) ; if ( $ widget && ! empty ( $ output ) ) { $ output =  <<<JS
<script type='text/javascript'>
    window.addEventListener('load', function() {
        $output
    }, false)
</script>
JS ; } return $ output ; }
Form output for includes.

@param array  $includes String files to include.
@param string $widget   Widget name.

@return string
Form output for includes .