S
S
serik2020-12-24 12:23:03
1C-Bitrix
serik, 2020-12-24 12:23:03

How to check the boxes at the time of creating the info block “Character code; If the code is given, then check for uniqueness; Transliterate from title with;"?

I create an infoblock with a code, what parameter should I pass in order to put the following checkboxes?
td2ciWQMQEK0j4edPMDZrQ.png

$arFields = array(
            "ACTIVE"=>"Y",
            "NAME" => $name,
            "CODE" => [   //Вот тут не могу правильно передать параметр
                'IS_REQUIRED' => 'Y',
                'DEFAULT_VALUE' => [
                    'UNIQUE' => 'Y',
                    'TRANSLITERATION' => 'Y'
                ]
            ],
            "XML_ID" => '',
            "IBLOCK_TYPE_ID" => 'auction',
            "SITE_ID" => array(DEFAULT_SITE_ID),
            "GROUP_ID" => array("2"=>"R", $groupId => "W"),
            "INDEX_SECTION" => "Y",
            "INDEX_ELEMENT" => "Y",
            "WF_TYPE"=>"N",
            "LIST_PAGE_URL" => "#SITE_DIR#/",
            "SECTION_PAGE_URL" => "#SITE_DIR#/#SECTION_CODE_PATH#/",
            "DETAIL_PAGE_URL" => "#SITE_DIR#/#IBLOCK_ID#/#ELEMENT_CODE#/",
            "CANONICAL_PAGE_URL" => "https://#SERVER_NAME#/#SITE_DIR#/#IBLOCK_ID#//#ELEMENT_ID#/",
        );

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2020-12-25
@black_xe

Sergei Sapogin ,

if (CModule::IncludeModule('iblock'))
{
$Id = 2;//инфоблок
$fields = CIBlock::getFields($Id);
$fields["CODE"]["IS_REQUIRED"] = "Y";
$fields["CODE"]["DEFAULT_VALUE"]["UNIQUE"] = "Y";
$fields["CODE"]["DEFAULT_VALUE"]["TRANSLITERATION"] = "Y";
CIBlock::setFields($Id, $fields);
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question