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