public function getCustomJsAction(ParamFetcher $paramFetcher)
{
$bundle = $paramFetcher->get('bundle');
$code = $paramFetcher->get('code');
$onLoad = $paramFetcher->get('onLoad');
$module = preg_replace('[^a-zA-Z0-9_-]', '', $bundle);
$code = preg_replace('[^a-zA-Z0-9_-]', '', $code);
$onLoad = preg_replace('[^a-zA-Z0-9_-]', '', $onLoad);
$bundle = $this->jarves->getBundle($module);
$file = $bundle->getPath() . '/Resources/public/admin/js/' . $code . '.js';
if (!file_exists($file)) {
$content = "contentCantLoaded_" . $onLoad . "('{$file}');\n";
} else {
$content = file_get_contents($file);
$content .= "\n";
$content .= "contentLoaded_" . $onLoad . '();' . "\n";
}
$response = new Response($content);
$response->headers->set('Content-Type', 'text/javascript');
return $response;
}