Example #1
0
 /**
  * @inheritdoc
  */
 public function validate(array $request, array $builderData)
 {
     $iblockElement = new \CIBlockElement();
     $fields['IBLOCK_ID'] = $builderData['DATA']['ID'];
     foreach ($builderData['DEFAULT_FIELDS'] as $fieldName => $field) {
         if (isset($request[$fieldName])) {
             $fields[$fieldName] = $request[$fieldName];
         }
     }
     foreach ($builderData['FIELDS'] as $fieldName => $field) {
         if (isset($request[$fieldName])) {
             $fields['PROPERTY_VALUES'][$fieldName] = $request[$fieldName];
         }
     }
     if (!$iblockElement->checkFields($fields)) {
         $iblockErrorParser = new IBlockErrorParser($builderData['FIELDS'], $builderData['DEFAULT_FIELDS']);
         $this->errorList = $iblockErrorParser->parse($iblockElement->LAST_ERROR);
     }
 }