<?php

class ACMS_GET_Js extends ACMS_GET
{
    function get()
    {
        App::setIsAcmsJsLoaded(true);
        $jsModulesBuilder = App::make('view.js-modules');
        assert($jsModulesBuilder instanceof \Acms\Services\View\JsModulesBuilder);
        $jsModules = $jsModulesBuilder->getJsModules();
        $query = http_build_query($jsModules, '&');

        $Tpl = new Template($this->tpl, new ACMS_Corrector());
        if (!empty($query)) {
            $Tpl->add(null, [
                'arguments' => '?' . $query,
            ]);
        }
        return $Tpl->get();
    }
}
