Helper :: prepareFileAttachments: Bitrix method

      
<?php 
//  Bitrix\Bizproc\Automation\Helper :: prepareFileAttachments()
//  /dist/bitrix/modules/bizproc/lib/automation/helper.php:164

    
public static function prepareFileAttachments(array $documentType$files)
    {
        
$result = [];
        
$files = (array)$files;
        
$documentUserFields = static::getDocumentFields($documentType'file');

        foreach (
$files as $file)
        {
            if (!
is_scalar($file))
                continue;

            foreach (
$documentUserFields as $id => $field)
            {
                if (
$file !== $field['Expression'])
                    continue;

                
$result[] = array(
                    
'id' => $id,
                    
'expression' => $field['Expression'],
                    
'name' => $field['Name'],
                    
'type' => 'file'
                
);
            }
        }
        return 
$result;
    }