• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/component_template.php
  • Класс: CBitrixComponentTemplate
  • Вызов: CBitrixComponentTemplate::__IncludeJSFile
public function __IncludeJSFile()
{
	/** @global CMain $APPLICATION */
	global $APPLICATION;

	if ($this->__folder <> '')
	{
		if (
			$this->__hasJS
			|| file_exists($_SERVER["DOCUMENT_ROOT"].$this->__folder."/script.js")
		)
		{
			$APPLICATION->AddHeadScript($this->__folder."/script.js");
			//Check if parent component exists and plug js it to it's "collection"
			if($this->__component && $this->__component->__parent)
				$this->__component->__parent->addChildJS($this->__folder."/script.js");
		}
	}
}