public function renderLegacyJs()
    {
        $jsFiles = [];
        $jsCodeLines = [];

        foreach ($this->legacyHelper->get('js_files', []) as $jsItem) {
            // List of items can contain empty elements, path to files or code
            if (!empty($jsItem)) {
                if (isset($jsItem[4]) && $this->isFile($jsItem, '.js')) {
                    $jsFiles[] = $jsItem;
                } else {
                    $jsCodeLines[] = $jsItem;
                }
            }
        }

        return $this->environment->render(
            $this->jsTemplate,
            [
                'js_files' => $jsFiles,
                'js_code_lines' => $jsCodeLines,
            ]
        );
    }