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/ui/iblock/ |
Upload File : |
<?php namespace Yandex\Market\Ui\Iblock; use Bitrix\Main; use Yandex\Market\Reference\Assert; use Yandex\Market\Reference\Event; /** @noinspection PhpUnused */ class FieldPublisher extends Event\Regular { const FIELD = 0; const PROPERTY = 1; public static function getHandlers() { $handlers = []; foreach (self::getClassMap() as $type => list($userFieldClass, $propertyClass)) { if ($userFieldClass !== null) { $handlers[] = [ 'module' => 'main', 'event' => 'OnUserTypeBuildList', 'method' => 'getFieldDescription', 'arguments' => [$type], ]; } if ($propertyClass !== null) { $handlers[] = [ 'module' => 'iblock', 'event' => 'OnIBlockPropertyBuildList', 'method' => 'getPropertyDescription', 'arguments' => [$type], ]; } } return $handlers; } public static function getFieldDescription($type) { return self::buildDescription($type, self::FIELD); } public static function getPropertyDescription($type) { return self::buildDescription($type, self::PROPERTY); } /** @noinspection PhpUndefinedMethodInspection */ private static function buildDescription($type, $entity) { try { $classMap = self::getClassMap(); Assert::notNull($classMap[$type][$entity], sprintf('classMap[%s][%s]', $type, $entity)); $class = $classMap[$type][$entity]; Assert::methodExists($class, 'getUserTypeDescription'); return $class::getUserTypeDescription(); } catch (Main\SystemException $e) { trigger_error($e->getMessage(), E_USER_WARNING); return null; } } private static function getClassMap() { return [ 'Category' => [ CategoryField::class, CategoryProperty::class ], ]; } }