• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/comp_parameters.php
  • Класс: CIBlockParameters
  • Вызов: CIBlockParameters::GetInheritedPropertyTemplateSectionMenuItems
static function GetInheritedPropertyTemplateSectionMenuItems($iblock_id, $action_function, $menuID, $inputID = "")
{
	global $USER_FIELD_MANAGER;
	$result = array();
	$result["this"] = array(
		"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SECTION"),
		"MENU" => array(
			array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SECTION_NAME"),
				"ONCLICK" => "$action_function('{=this.Name}', '$menuID', '$inputID')",
			),
			array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SECTION_LOWER_NAME"),
				"ONCLICK" => "$action_function('{=lower this.Name}', '$menuID', '$inputID')",
			),
			array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SECTION_CODE"),
				"ONCLICK" => "$action_function('{=this.Code}', '$menuID', '$inputID')",
			),
			array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SECTION_PREVIEW_TEXT"),
				"ONCLICK" => "$action_function('{=this.PreviewText}', '$menuID', '$inputID')",
			),
		),
	);
	if ($iblock_id > 0)
	{
		$result["properties"] = array(
			"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PROPERTIES"),
			"MENU" => array(
			),
		);
		$arProperty = $USER_FIELD_MANAGER->GetUserFields("IBLOCK_".$iblock_id."_SECTION");
		foreach($arProperty as $property)
		{
			if (isset($property['USER_TYPE']['BASE_TYPE']) && $property['USER_TYPE']['BASE_TYPE'] !== BitrixMainUserFieldTypesFileType::USER_TYPE_ID)
			{
				$result["properties"]["MENU"][] = array(
					"TEXT" => $property["FIELD_NAME"],
					"ONCLICK" => "$action_function('{=this.property.".mb_strtolower(mb_substr($property["FIELD_NAME"], 3))."}', '$menuID', '$inputID')",
				);
			}
		}
	}
	$result["parent"] = array(
		"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT"),
		"MENU" => array(
			array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT_NAME"),
				"ONCLICK" => "$action_function('{=parent.Name}', '$menuID', '$inputID')",
			),
			array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT_CODE"),
				"ONCLICK" => "$action_function('{=parent.Code}', '$menuID', '$inputID')",
			),
			array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_PARENT_TEXT"),
				"ONCLICK" => "$action_function('{=parent.PreviewText}', '$menuID', '$inputID')",
			),
		),
	);
	$result["iblock"] = array(
		"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK"),
		"MENU" => array(
			array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK_NAME"),
				"ONCLICK" => "$action_function('{=iblock.Name}', '$menuID', '$inputID')",
			),
			array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK_CODE"),
				"ONCLICK" => "$action_function('{=iblock.Code}', '$menuID', '$inputID')",
			),
			array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_IBLOCK_TEXT"),
				"ONCLICK" => "$action_function('{=iblock.PreviewText}', '$menuID', '$inputID')",
			),
		),
	);
	$catalog = false;
	$showCatalogSeo = false;
	if (self::$catalogIncluded === null)
		self::$catalogIncluded = Loader::includeModule('catalog');
	if (self::$catalogIncluded)
	{
		if ($iblock_id > 0)
			$catalog = CCatalogSku::GetInfoByIBlock($iblock_id);
		$showCatalogSeo = (is_array($catalog) && $catalog['CATALOG_TYPE'] != CCatalogSku::TYPE_PRODUCT);
		if ($showCatalogSeo)
		{
			$result["store"] = array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_STORE"),
				"MENU" => array(),
			);
			foreach (self::getCatalogStores() as $store)
			{
				$result["store"]["MENU"][] = array(
					"TEXT" => ($store["TITLE"] != '' ? $store["TITLE"] : $store["ADDRESS"]),
					"ONCLICK" => "$action_function('{=catalog.store.".$store["ID"].".name}', '$menuID', '$inputID')",
				);
			}
		}
	}
	$result["misc"] = array(
		"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_MISC"),
		"MENU" => array(),
	);
	$result["misc"]["MENU"][] =  array(
		"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_SECTIONS_PATH"),
		"ONCLICK" => "$action_function('{=concat this.sections.name this.name " / "}', '$menuID', '$inputID')",
	);
	if (self::$catalogIncluded)
	{
		if ($showCatalogSeo)
		{
			$result["misc"]["MENU"][] = array(
				"TEXT" => Loc::getMessage("IB_COMPLIB_POPUP_STORE_LIST"),
				"ONCLICK" => "$action_function('{=concat catalog.store ", "}', '$menuID', '$inputID')",
			);
		}
	}
	$r = array();
	foreach($result as $category)
	{
		if (!empty($category) && !empty($category["MENU"]))
		{
			$r[] = $category;
		}
	}
	return $r;
}