26 \
Magento\Framework\View\Asset\Repository $assetRepo,
27 \
Magento\Framework\View\LayoutInterface $layout,
31 $this->_actionFactory = $actionFactory;
32 $this->_layout = $layout;
34 parent::__construct($assetRepo, $layout,
$data);
36 $this->setActions([]);
37 $this->setType(\
Magento\Rule\Model\Action\Collection::class);
53 public function asArray(array $arrAttributes = [])
55 $out = parent::asArray();
57 foreach ($this->getActions() as
$item) {
58 $out[
'actions'][] =
$item->asArray();
69 if (!empty($arr[
'actions']) && is_array($arr[
'actions'])) {
70 foreach ($arr[
'actions'] as $actArr) {
71 if (empty($actArr[
'type'])) {
74 $action = $this->_actionFactory->create($actArr[
'type']);
75 $action->loadArray($actArr);
88 $actions = $this->getActions();
90 $action->setRule($this->getRule());
93 if (!$action->getId()) {
94 $action->setId($this->getId() .
'.' .
sizeof($actions));
97 $this->setActions($actions);
106 $html = $this->
getTypeElement()->toHtml() .
'Perform following actions: ';
107 if ($this->getId() !=
'1') {
118 return $this->
getForm()->addField(
119 'action:' . $this->getId() .
':new_child',
122 'name' => $this->elementName .
'[actions][' . $this->getId() .
'][new_child]',
127 $this->_layout->getBlockSingleton(\
Magento\Rule\Block\Newchild::class)
136 $html = $this->
asHtml() .
'<ul id="action:' . $this->getId() .
':children">';
137 foreach ($this->getActions() as $cond) {
138 $html .=
'<li>' . $cond->asHtmlRecursive() .
'</li>';
151 $str =
__(
"Perform following actions");
162 foreach ($this->getActions() as $action) {
163 $str .=
"\n" . $action->asStringRecursive($level + 1);
173 foreach ($this->getActions() as $action) {
asStringRecursive($level=0)
asArray(array $arrAttributes=[])
__construct(\Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\View\LayoutInterface $layout, \Magento\Rule\Model\ActionFactory $actionFactory, array $data=[])
addAction(ActionInterface $action)
getNewChildSelectOptions()