Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
factory.php
1<?php
2
3
5
6
8
9class Factory
10{
11 static public function create($type, $params=[])
12 {
13 if($type == BlockType::FINANCE_INFO)
14 {
15 return new \Bitrix\Sale\Helpers\Admin\Blocks\OrderFinanceInfo();
16 }
17 elseif ($type == BlockType::PAYMENT)
18 {
19 return new \Bitrix\Sale\Helpers\Admin\Blocks\OrderPayment();
20 }
21 elseif ($type == BlockType::BUYER)
22 {
23 return new OrderBuyer();
24 }
25 elseif ($type == BlockType::ADDITIONAL)
26 {
27 return new OrderAdditional();
28 }
29 elseif ($type == BlockType::STATUS)
30 {
31 return new OrderStatus();
32 }
33 elseif ($type == BlockType::INFO)
34 {
35 return new \Bitrix\Sale\Exchange\Integration\Admin\Blocks\OrderInfo();
36 }
37 elseif ($type == BlockType::SHIPMENT_BASKET)
38 {
39 $shipment = $params['shipment'];
40 $jsObjName = isset($params['jsObjName'])?$params['jsObjName']:'';
41 $idPrefix = isset($params['idPrefix'])?$params['idPrefix']:'';
42
43 return new \Bitrix\Sale\Helpers\Admin\Blocks\OrderBasketShipment($shipment, $jsObjName, $idPrefix);
44 }
45 elseif ($type == BlockType::SHIPMENT_STATUS)
46 {
47 return new \Bitrix\Sale\Helpers\Admin\Blocks\OrderShipmentStatus();
48 }
49 elseif ($type == BlockType::SHIPMENT || $type == BlockType::DELIVERY)
50 {
51 return new \Bitrix\Sale\Helpers\Admin\Blocks\OrderShipment();
52 }
53 elseif ($type == BlockType::BASKET)
54 {
55 $order = $params['order'];
56 $jsObjName = isset($params['jsObjName']) ? $params['jsObjName']:'';
57 $idPrefix = isset($params['idPrefix']) ? $params['idPrefix']:'';
58 $createProductBasement = isset($params['createProductBasement']) ? $params['createProductBasement']: true;
59 $mode = isset($params['mode']) ? $params['mode']: \Bitrix\Sale\Helpers\Admin\Blocks\OrderBasket::EDIT_MODE;
60
61 return new \Bitrix\Sale\Helpers\Admin\Blocks\OrderBasket($order, $jsObjName, $idPrefix, $createProductBasement, $mode);
62 }
63 elseif ($type == BlockType::MARKER)
64 {
65 return new \Bitrix\Sale\Helpers\Admin\Blocks\OrderMarker();
66 }
67 elseif ($type == BlockType::ANALYSIS)
68 {
69 return new OrderAnalysis();
70 }
71 elseif ($type == BlockType::DISCOUNT)
72 {
73 return new OrderDiscount();
74 }
75 else
76 {
77 throw new \Bitrix\Main\NotSupportedException("Mode type: '".$type."' is not supported in current context");
78 }
79 }
80}