• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/block.php
  • Класс: BitrixLandingBlock
  • Вызов: Block::includeBlockClass
protected function includeBlockClass($path)
{
	static $classes = [];
	static $calledClasses = [];

	if (!isset($classes[$path]))
	{
		// include class
		$beforeClasses = get_declared_classes();
		$beforeClassesCount = count($beforeClasses);
		include_once($path);
		$afterClasses = get_declared_classes();
		$afterClassesCount = count($afterClasses);

		// ... and detect class name
		for ($i = $beforeClassesCount; $i < $afterClassesCount; $i++)
		{
			if (is_subclass_of($afterClasses[$i], '\Bitrix\Landing\LandingBlock'))
			{
				$classes[$path] = $afterClasses[$i];
			}
		}
	}

	$landingId = $this->getLandingId();
	$landingPath = $path . '@' . $landingId;

	// call init method
	if (!isset($calledClasses[$landingPath]))
	{
		$calledClasses[$landingPath] = new $classes[$path];
		$calledClasses[$landingPath]->init([
			'site_id' => $this->getSiteId(),
			'landing_id' => $this->getLandingId()
		]);
	}

	return $calledClasses[$landingPath];
}