Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
MultiplyAction.php
1<?php
2
4
9
11{
12 protected const JS_COMMAND = 'multiply';
13
14 public function execute(bool $undo = true): bool
15 {
16 foreach ($this->params as $param)
17 {
18 if (is_array($param) && $param['ACTION'] && $param['ACTION_PARAMS'])
19 {
20 $action = ActionFactory::getAction($param['ACTION'], $undo);
21 if ($action)
22 {
23 $action->setParams($param['ACTION_PARAMS'], true);
24 $action->execute($undo);
25 }
26 }
27 }
28
29 return true;
30 }
31
32 public static function enrichParams(array $params): array
33 {
34 return $params;
35 }
36
41 public function getJsCommand(bool $undo = true): array
42 {
43 $command = parent::getJsCommand($undo);
44 $command['params'] = [];
45
46 foreach ($this->params as $param)
47 {
48 if (is_array($param) && $param['ACTION'] && $param['ACTION_PARAMS'])
49 {
50 $action = ActionFactory::getAction($param['ACTION'], $undo);
51 if ($action)
52 {
53 $action->setParams($param['ACTION_PARAMS'], true);
54 $command['params'][] = $action->getJsCommand($undo);
55 }
56 }
57 }
58
59 return $command;
60 }
61}
static getAction(string $actionName, ?bool $undo=false)