• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/template/entity/section.php
  • Класс: BitrixIblockTemplateEntitySection
  • Вызов: Section::resolve
public function resolve($entity)
{
	if ($entity === "property")
	{
		if (!$this->property && $this->loadFromDatabase())
		{
			if ($this->fields["IBLOCK_ID"] > 0)
			{
				$this->property = new SectionProperty($this->id);
				$this->property->setIblockId($this->fields["IBLOCK_ID"]);
			}
		}

		if ($this->property)
			return $this->property;
	}
	elseif ($entity === "iblock")
	{
		if (!$this->iblock && $this->loadFromDatabase())
		{
			if ($this->fields["IBLOCK_ID"] > 0)
				$this->iblock = new Iblock($this->fields["IBLOCK_ID"]);
		}

		if ($this->iblock)
			return $this->iblock;
	}
	elseif ($entity === "parent")
	{
		if (!$this->parent && $this->loadFromDatabase())
		{
			if ($this->fields["IBLOCK_SECTION_ID"] > 0)
				$this->parent = new Section($this->fields["IBLOCK_SECTION_ID"]);
			else
				return $this->resolve("iblock");
		}

		if ($this->parent)
			return $this->parent;
	}
	elseif ($entity === "sections")
	{
		if (!$this->sections && $this->loadFromDatabase())
		{
			if ($this->fields["IBLOCK_SECTION_ID"] > 0)
				$this->sections = new SectionPath($this->fields["IBLOCK_SECTION_ID"]);
		}

		if ($this->sections)
			return $this->sections;
	}
	elseif ($entity === "catalog")
	{
		if (!$this->catalog && $this->loadFromDatabase())
		{
			if (BitrixMainLoader::includeModule('catalog'))
				$this->catalog = new ElementCatalog(0);
		}

		if ($this->catalog)
			return $this->catalog;
	}
	return parent::resolve($entity);
}