23 $valueTmp = (int) current($value);
27 $valueTmp = (int) $value;
33 $idKey = ($fieldType->
getType() ===
'UF:iblock_section') ?
'SECTION_ID' :
'ID';
34 $elementIterator = \CIBlockElement::getList([], [$idKey => $valueTmp],
false,
false, array(
'ID',
'IBLOCK_ID'));
35 if ($element = $elementIterator->fetch())
37 $iblockId = $element[
'IBLOCK_ID'];
41 if ($iblockId <= 0 && (
int) $fieldType->
getOptions() > 0)
48 $result =
'<select id="WFSFormOptionsX" onchange="'
49 .Main\Text\HtmlFilter::encode($callbackFunctionName).
'(this.options[this.selectedIndex].value)">';
51 $iblockTypeIterator = \CIBlockParameters::getIBlockTypes();
52 foreach ($iblockTypeIterator as $iblockTypeId => $iblockTypeName)
54 $result .=
'<optgroup label="'.Main\Text\HtmlFilter::encode($iblockTypeName).
'">';
56 $iblockIterator = \CIBlock::getList([
'SORT' =>
'ASC'], [
'TYPE' => $iblockTypeId,
'ACTIVE' =>
'Y']);
57 while ($iblock = $iblockIterator->fetch())
59 $result .=
'<option value="'.$iblock[
'ID'].
'"'.(($iblock[
'ID'] == $iblockId) ?
' selected' :
'').
'>'
61 if (($defaultIBlockId <= 0) || ($iblock[
'ID'] == $iblockId))
62 $defaultIBlockId = $iblock[
'ID'];
65 $result .=
'</optgroup>';
67 $result .=
'</select><!--__defaultOptionsValue:'.$defaultIBlockId.
'--><!--__modifyOptionsPromt:'
68 .Loc::getMessage(
'BP_FIELDTYPE_UF_INFOBLOCK').
'-->';