P
P
Pavel Sidorov2019-07-26 14:07:52
1C-Bitrix
Pavel Sidorov, 2019-07-26 14:07:52

Why is the infoblock type taken from the bitrix core through the installer wizard?

There is a ready-made solution installer located at /bitrix/wizards/softwarepass6454597test
There is an import of infoblocks from xml
in the ready-made solution then I write it in portfolio.php potolki.php services.php files. I call the type "contentsoft"
Further, after installing the solution, everything is fine, but instead of my specified infoblock type, another type appears with the ID 1c_catalog - this type takes from the Bitrix core and all the infoblocks I need are written to it.
Guys, where am I missing?
here is the code example
types.php

<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)
  die();
if(!CModule::IncludeModule("iblock"))
  return;
$arTypes = Array(
  Array(
    "ID" => "contentsoft",
    "SECTIONS" => "Y",
    "IN_RSS" => "N",
    "SORT" => 200,
    "LANG" => Array(),
  ),
);
$arLanguages = Array();
$rsLanguage = CLanguage::GetList($by, $order, array());
while($arLanguage = $rsLanguage->Fetch())
  $arLanguages[] = $arLanguage["LID"];
$iblockType = new CIBlockType;
foreach($arTypes as $arType)
{
  $dbType = CIBlockType::GetList(Array(),Array("=ID" => $arType["ID"]));
  if($dbType->Fetch())
    continue;
  foreach($arLanguages as $languageID)
  {
    WizardServices::IncludeServiceLang("type.php", $languageID);
    $code = strtoupper($arType["ID"]);
    $arType["LANG"][$languageID]["NAME"] = GetMessage($code."_TYPE_NAME");
    $arType["LANG"][$languageID]["ELEMENT_NAME"] = GetMessage($code."_ELEMENT_NAME");
    if ($arType["SECTIONS"] == "Y")
      $arType["LANG"][$languageID]["SECTION_NAME"] = GetMessage($code."_SECTION_NAME");
  }
  $iblockType->Add($arType);
}
?>

type.php
<?
$MESS["CONTENTSOFT_TYPE_NAME"] = "Контент2";
$MESS["CONTENTSOFT_ELEMENT_NAME"] = "Элементы";
$MESS["CONTENTSOFT_SECTION_NAME"] = "Разделы";
?>

infoblock
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)
  die();

if(!CModule::IncludeModule("iblock"))
  return;

$iblockXMLFile = WIZARD_SERVICE_RELATIVE_PATH."/xml/".LANGUAGE_ID."/services.xml";
$iblockCode = "services".WIZARD_SITE_ID;
$iblockType = "contentsoft";

$rsIBlock = CIBlock::GetList(array(), array("CODE" => $iblockCode, "TYPE" => $iblockType));
$iblockID = false;
if ($arIBlock = $rsIBlock->Fetch())
{
  $iblockID = $arIBlock["ID"];
  if (WIZARD_REINSTALL_DATA)
  {
    CIBlock::Delete($arIBlock["ID"]);
    $iblockID = false;
  }
}

if($iblockID == false)
{
  $permissions = Array(
    "1" => "X",
    "2" => "R"
  );
  $dbGroup = CGroup::GetList($by = "", $order = "", Array("STRING_ID" => "content_editor"));
  if($arGroup = $dbGroup -> Fetch())
  {
    $permissions[$arGroup["ID"]] = 'W';
  };
  $iblockID = WizardServices::ImportIBlockFromXML(
    $iblockXMLFile,
    "services",
    $iblockType,
    WIZARD_SITE_ID,
    $permissions
  );

  if ($iblockID < 1)
    return;

  //WizardServices::SetIBlockFormSettings($iblockID, Array ( 'tabs' => GetMessage("W_IB_GROUP_PHOTOG_TAB1").$REAL_PICTURE_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB2").$rating_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB3").$vote_count_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB4").$vote_sum_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB5").$APPROVE_ELEMENT_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB6").$PUBLIC_ELEMENT_PROPERTY_ID.GetMessage("W_IB_GROUP_PHOTOG_TAB7"), ));

  //IBlock fields
  $iblock = new CIBlock;
  $arFields = Array(
    "ACTIVE" => "Y",
    "FIELDS" => array ( 'IBLOCK_SECTION' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'ACTIVE' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'Y', ), 'ACTIVE_FROM' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '=today', ), 'ACTIVE_TO' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'SORT' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'NAME' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => '', ), 'PREVIEW_PICTURE' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array ( 'FROM_DETAIL' => 'N', 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', ), ), 'PREVIEW_TEXT_TYPE' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text', ), 'PREVIEW_TEXT' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'DETAIL_PICTURE' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => array ( 'SCALE' => 'N', 'WIDTH' => '', 'HEIGHT' => '', 'IGNORE_ERRORS' => 'N', ), ), 'DETAIL_TEXT_TYPE' => array ( 'IS_REQUIRED' => 'Y', 'DEFAULT_VALUE' => 'text', ), 'DETAIL_TEXT' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'XML_ID' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'CODE' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), 'TAGS' => array ( 'IS_REQUIRED' => 'N', 'DEFAULT_VALUE' => '', ), ),
    "CODE" => $iblockCode,
    "XML_ID" => $iblockCode,
    "NAME" => $iblock->GetArrayByID($iblockID, "NAME"),
    //"NAME" => "[".WIZARD_SITE_ID."] ".$iblock->GetArrayByID($iblockID, "NAME")
  );

  $iblock->Update($iblockID, $arFields);
}
else
{
  $arSites = array();
  $db_res = CIBlock::GetSite($iblockID);
  while ($res = $db_res->Fetch())
    $arSites[] = $res["LID"];
  if (!in_array(WIZARD_SITE_ID, $arSites))
  {
    $arSites[] = WIZARD_SITE_ID;
    $iblock = new CIBlock;
    $iblock->Update($iblockID, array("LID" => $arSites));
  }
}

CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH."/services/index.php", array("PROMOS_IBLOCK_ID" => $iblockID));

?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Sidorov, 2019-07-26
@pavel__sidorov

I figured it out ... in the lang folder, except for ru, there should also be an en folder

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question