示例#1
0
 /**
  * Internationalize info block.
  * 
  * @param string $propCodePublicId
  * @param string $propCodeLang
  * @param string $defaultLang
  * 
  * @throws InternationalizeException
  */
 public function internationalize($propCodePublicId, $propCodeLang, $defaultLang)
 {
     $saveResult = i18nTable::save(['IBLOCK_ID' => $this->getIblockId(), 'PROP_CODE_PUBLIC_ID' => $propCodePublicId, 'PROP_CODE_LANG' => $propCodeLang]);
     if (!$saveResult->isSuccess()) {
         throw new InternationalizeException($saveResult->getErrorMessages());
     }
 }
示例#2
0
 /**
  * Gets i18n settings of info block.
  * 
  * @param integer $iblockId
  * @return array|null
  */
 public static function getIblockSettings($iblockId)
 {
     $rsSettings = i18nTable::query()->setFilter(['IBLOCK_ID' => $iblockId])->setSelect(['PROP_CODE_PUBLIC_ID', 'PROP_CODE_LANG'])->exec();
     if ($settings = $rsSettings->fetch()) {
         $propIdPublicId = static::getPropIdByCode($iblockId, $settings['PROP_CODE_PUBLIC_ID']);
         $propIdLang = static::getPropIdByCode($iblockId, $settings['PROP_CODE_LANG']);
         if (!$propIdPublicId || !$propIdLang) {
             return null;
         }
         $settings['PROP_ID_PUBLIC_ID'] = $propIdPublicId;
         $settings['PROP_ID_LANG'] = $propIdLang;
         return $settings;
     }
     return null;
 }