...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/webform/embed/rest.php
- Класс: Bitrix\Crm\WebForm\Embed\Rest
- Вызов: Rest::getForm
static function getForm($query) { $formId = empty($query['id']) ? null : (int) $query['id']; $securityCode = empty($query['sec']) ? null : $query['sec']; $loaderOnly = !empty($query['loaderOnly']); if (!WebForm\Manager::isEmbeddingAvailable()) { self::printErrors(["Form embedding feature disabled."]); } if (!$formId) { self::printErrors(["Parameter `id` required."]); } if (!$securityCode) { self::printErrors(["Parameter `sec` required."]); } $cacheKey = 'WebForm:'.$formId.':'.($securityCode ? substr(md5($securityCode),-6) : '').':'.($loaderOnly ? '1' : '0'); $cachePath = '/crm/webform/rest_get_form/'.$formId.'/'; $ttl = 1800; // 30 min $cache = \Bitrix\Main\Application::getInstance()->getCache(); if ($cache->initCache($ttl, $cacheKey, $cachePath)) { $response = $cache->getVars(); } else { $cache->startDataCache(); $cacheTag = WebForm\Form::getCacheTag($formId); $taggedCache = \Bitrix\Main\Application::getInstance()->getTaggedCache(); $taggedCache->startTagCache($cachePath); $taggedCache->registerTag($cacheTag); $taggedCache->endTagCache(); $form = new WebForm\Form($formId); if (!$form->checkSecurityCode($securityCode)) { self::printErrors(["Parameter `security_sign` is invalid."]); } if (!$form->isActive()) { self::printErrors(["Form with id=`$formId` is disabled."]); } $appPack = Webpack\Form\App::instance(); $scripts = WebForm\Script::getListContext($form->get(), []); $response = [ 'config' => $loaderOnly ? null : (new Config($form))->toArray(), 'loader' => [ 'form' => [ 'inline' => $scripts['INLINE']['text'], 'click' => $scripts['CLICK']['text'], 'auto' => $scripts['AUTO']['text'], ], 'app' => [ 'link' => $appPack->getEmbeddedFileUrl(), 'script' => $appPack->getEmbeddedBody(), ], ], ]; $cache->endDataCache($response); } return $response; }