<?$APPLICATION->IncludeComponent(
"gri:slider",
".default",
Array(
"COMPONENT_TEMPLATE" => ".default",
"IBLOCK_ID" => "27",
"IBLOCK_TYPE" => "slider",
"PROPERTY_CODE" => ""
)
);?>
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
if(!CModule::IncludeModule("iblock"))
return;
$arTypesEx = CIBlockParameters::GetIBlockTypes(array("-"=>" "));
$arIBlocks=array();
$db_iblock = CIBlock::GetList(array("SORT"=>"ASC"), array("TYPE" => ($arCurrentValues["IBLOCK_TYPE"]!="-"?$arCurrentValues["IBLOCK_TYPE"]:"")));
while($arRes = $db_iblock->Fetch())
$arIBlocks[$arRes["ID"]] = "[".$arRes["ID"]."] ".$arRes["NAME"];
$arProperty_LNS = array();
$rsProp = CIBlockProperty::GetList(array("sort"=>"asc", "name"=>"asc"), array("ACTIVE"=>"Y", "IBLOCK_ID"=>($arCurrentValues["IBLOCK_ID"])));
while ($arr=$rsProp->Fetch())
{
$arProperty[$arr["CODE"]] = "[".$arr["CODE"]."] ".$arr["NAME"];
if (in_array($arr["PROPERTY_TYPE"], array("L", "N", "S")))
{
$arProperty_LNS[$arr["CODE"]] = "[".$arr["CODE"]."] ".$arr["NAME"];
}
}
$arComponentParameters = array(
"PARAMETERS" => array(
"IBLOCK_TYPE" => array(
"PARENT" => "BASE",
"NAME" => "Тип инфоблока",
"TYPE" => "LIST",
"VALUES" => $arTypesEx,
"DEFAULT" => "news",
"REFRESH" => "Y",
),
"IBLOCK_ID" => array(
"PARENT" => "BASE",
"NAME" => "Инфобок",
"TYPE" => "LIST",
"VALUES" => $arIBlocks,
"DEFAULT" => '={$_REQUEST["ID"]}',
"ADDITIONAL_VALUES" => "Y",
"REFRESH" => "Y",
),
"PROPERTY_CODE" => array(
"PARENT" => "DATA_SOURCE",
"NAME" => "Укажите свойство по которому будет фильтроваться товары для слайдера",
"TYPE" => "LIST",
"MULTIPLE" => "N",
"VALUES" => $arProperty_LNS,
"ADDITIONAL_VALUES" => "Y",
),
),
);
Получается мне нужно брать первый элемент массива. Я меняю в коде
Но тогда всё ломается и state становится undefined. Почему так происходит?