Type::getClassName

  1. Bitrix24 API (v. 23.675.0)
  2. landing
  3. Type
  4. getClassName
  • Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/node/type.php
  • Класс: BitrixLandingNodeType
  • Вызов: Type::getClassName
static function getClassName(string $type): string
{
	$type = mb_strtolower($type);

	if ($type === '' || $type === 'type')
	{
		throw new BitrixMainArgumentTypeException(
			'Invalid node type'
		);
	}

	if (isset(self::$classes[$type]))
	{
		return self::$classes[$type];
	}

	$class = __NAMESPACE__ . '\' . $type;

	// check custom classes
	$event = new BitrixMainEvent(
		'landing',
		'onGetNodeClass',
		[
			'type' => $type
		]
	);
	$event->send();
	/** @var BitrixMainORMEventResult $result */
	foreach ($event->getResults() as $result)
	{
		if ($result->getType() != BitrixMainEventResult::ERROR)
		{
			if (
				($modified = $result->getModified()) &&
				isset($modified['class']) &&
				is_subclass_of($modified['class'], '\Bitrix\Landing\Node')
			)
			{
				$class = $modified['class'];
			}
		}
	}

	self::$classes[$type] = $class;

	return self::$classes[$type];
}

Добавить комментарий