Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/yandex.market/lib/template/node/ |
Upload File : |
<?php namespace Yandex\Market\Template\Node; use Bitrix\Main; use Bitrix\Iblock; if (!Main\Loader::includeModule('iblock')) { throw new Main\SystemException('require module iblock'); return; } class Root extends Iblock\Template\NodeRoot { public function processValue(Iblock\Template\Entity\Base $entity) { if (empty($this->modifiers) && count($this->children) === 1) { /** @var \Bitrix\Iblock\Template\NodeBase $child */ $child = reset($this->children); $result = $child->process($entity); } else { $result = $this->process($entity); } return $result; } /** * @return array */ public function getChildren() { return $this->children; } public function getSourceSelect() { $result = []; $this->extendSourceSelect($result, $this->children); return $result; } protected function extendSourceSelect(&$result, $children) { foreach ($children as $child) { if ($child instanceof Field) { $sourceType = $child->getSourceType(); $sourceField = $child->getSourceField(); if ($sourceType !== '' && $sourceField !== '') { if (!isset($result[$sourceType])) { $result[$sourceType] = [ $sourceField ]; } else if (!in_array($sourceField, $result[$sourceType])) { $result[$sourceType][] = $sourceField; } } } else if ($child instanceof Operation) { $this->extendSourceSelect($result, $child->getParameters()); } } } }