• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/component.php
  • Класс: CBitrixComponent
  • Вызов: CBitrixComponent::includeComponent
public function includeComponent($componentTemplate, $arParams, $parentComponent, $returnResult = false)
{
	if (!$this->__bInited)
		return null;

	if ($componentTemplate !== false)
		$this->setTemplateName($componentTemplate);

	if ($parentComponent instanceof cbitrixcomponent)
		$this->__parent = $parentComponent;

	if (!isset($arParams["CACHE_TYPE"]) || ($arParams["CACHE_TYPE"] != "Y" && $arParams["CACHE_TYPE"] != "N"))
	{
		$arParams["CACHE_TYPE"] = "A";
	}

	if($this->classOfComponent)
	{
		/** @var CBitrixComponent $component  */
		$component = new $this->classOfComponent($this);
		$component->onIncludeComponentLang();

		$keysToExport = $component->listKeysSignedParameters();
		if($keysToExport)
		{
			$component->storeSignedParameters(array_intersect_key($arParams, array_combine($keysToExport, $keysToExport)));
		}

		$component->arParams = $component->onPrepareComponentParams($arParams);
		$component->__prepareComponentParams($component->arParams);

		$componentFrame = new BitrixMainCompositeInternalsAutomaticArea($component);
		$componentFrame->start();

		if($returnResult)
		{
			$component->executeComponent();
			$result = $component->arResult;
		}
		else
		{
			$result = $component->executeComponent();
		}

		$this->__arIncludeAreaIcons = $component->__arIncludeAreaIcons;
		$frameMode = $component->getFrameMode();

		$componentFrame->end();
	}
	else
	{
		$this->includeComponentLang();
		$this->__prepareComponentParams($arParams);
		$this->arParams = $arParams;

		$componentFrame = new BitrixMainCompositeInternalsAutomaticArea($this);
		$componentFrame->start();

		if($returnResult)
		{
			$this->__IncludeComponent();
			$result = $this->arResult;
		}
		else
		{
			$result = $this->__IncludeComponent();
		}

		$frameMode = $this->getFrameMode();

		$componentFrame->end();
	}

	if (!$frameMode)
	{
		$page = BitrixMainCompositePage::getInstance();
		$page->giveNegativeComponentVote($this->__name);
	}

	return $result;
}