Helper::getDocumentFields: Bitrix method

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

    
public static function getDocumentFields(array $documentType$typeFilter null)
    {
        
$key implode('@'$documentType);
        if (!isset(static::
$documentFields[$key]))
        {
            
$documentService = \CBPRuntime::GetRuntime(true)->getDocumentService();
            static::
$documentFields[$key] = $documentService->GetDocumentFields($documentType);
        }

        
$resultFields = array();

        if (
is_array(static::$documentFields[$key]))
        {
            foreach (static::
$documentFields[$key] as $id => $field)
            {
                if (
$field['Type'] === 'UF:boolean')
                {
                    
//Mark as bizproc boolean type
                    
$field['Type'] = $field['BaseType'] = 'bool';
                }

                if (
$field['Type'] === 'UF:date')
                {
                    
//Mark as bizproc date type
                    
$field['Type'] = $field['BaseType'] = 'date';
                }

                if (
$typeFilter !== null && $field['Type'] !== $typeFilter)
                    continue;

                
$field['Name'] = trim($field['Name']);

                
$resultFields[$id] = array(
                    
'Id' => $id,
                    
'Name' => $field['Name'],
                    
'Type' => $field['Type'],
                    
'BaseType' => $field['BaseType'],
                    
'Expression' => '{{'.$field['Name'].'}}',
                    
'SystemExpression' => '{=Document:'.$id.'}',
                    
'Options' => $field['Options']
                );
            }
        }
        return 
$resultFields;
    }