Bolt\Asset\Snippet\Queue::addJquery PHP Метод

addJquery() защищенный Метод

Some of the patterns that 'match' are: - jquery.js - jquery.min.js - jquery-latest.js - jquery-latest.min.js - jquery-1.8.2.min.js - jquery-1.5.js
protected addJquery ( Request $request, Response $response )
$request Symfony\Component\HttpFoundation\Request
$response Symfony\Component\HttpFoundation\Response
    protected function addJquery(Request $request, Response $response)
    {
        if (!$this->config->get('general/add_jquery', false) && !$this->config->get('theme/add_jquery', false)) {
            return;
        }
        if (Zone::isFrontend($request) === false) {
            return;
        }
        $html = $response->getContent();
        $regex = '/<script(.*)jquery(-latest|-[0-9\\.]*)?(\\.min)?\\.js/';
        if (!preg_match($regex, $html)) {
            $jqueryfile = $this->resources->getPath('app/view/js/jquery-2.2.4.min.js');
            $asset = (new Snippet())->setLocation(Target::BEFORE_JS)->setCallback('<script src="' . $jqueryfile . '"></script>');
            $this->injector->inject($asset, $asset->getLocation(), $response);
        }
    }