Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
extension.php
1<?php
2
4
11
13{
22 public function installAction($engineCode, $setup, $config): AjaxJson
23 {
24 $response = null;
25 try
26 {
27 if (is_string($engineCode) && is_array($setup) && is_array($config))
28 {
29 $meta = BusinessSuite\ServiceMetaData::create()
30 ->setService($service = Utils\ServiceFactory::getServiceByEngineCode($engineCode))
31 ->setEngineCode($engineCode)
32 ->setType($service::getTypeByEngine($engineCode));
33
34 $serviceContainer = ServiceAdapter::createServiceWrapperContainer()->setMeta($meta);
35
36 $response = AjaxJson::createSuccess([
37 'authUrl' => $serviceContainer->getAuthAdapter($meta->getType())
38 ->setConfig($config = Facebook\Config::loadFromArray($config))
39 ->setSetup($setup = Facebook\Setup::loadFromArray($setup))
40 ->setInstalls(Facebook\Installs::load())
41 ->getAuthUrl()
42 ]);
43 $response = ($setup->save()? $response : AjaxJson::createError(null,[]));
44 }
45 }
46 catch (BusinessSuite\Exception\ConfigException $exception)
47 {
48 $handler = BusinessSuite\Exception\ConfigExceptionHandler::handle($exception);
49 $response = AjaxJson::createError($handler->getErrorCollection(),$handler->getCustomData());
50 }
51 catch (\Throwable $exception)
52 {
53 $response = AjaxJson::createError();
54 }
55 finally
56 {
57 return $response;
58 }
59 }
60}
static getServiceByEngineCode(string $engineCode)
installAction($engineCode, $setup, $config)
Definition extension.php:22