PropertiesDialog :: getCurrentValues: Bitrix method

      
<?php 
//  Bitrix\Bizproc\Activity\PropertiesDialog :: getCurrentValues()
//  /dist/bitrix/modules/bizproc/lib/activity/propertiesdialog.php:159

    
public function getCurrentValues($compatible false)
    {
        if (!
is_array($this->currentValues))
        {
            
// Get current values from saved activity properties.
            
$this->currentValues = array();
            
$currentActivity = \CBPWorkflowTemplateLoader::findActivityByName(
                
$this->getWorkflowTemplate(),
                
$this->getActivityName()
            );

            if (
is_array($currentActivity) && is_array($currentActivity['Properties']))
            {
                
$map $this->getMap();
                foreach (
$map as $id => $property)
                {
                    if (!isset(
$property['FieldName']))
                        continue;

                    
$this->currentValues[$property['FieldName']] = null;

                    if (isset(
$currentActivity['Properties'][$id]))
                    {
                        if (
                            isset(
$property['Getter'])
                            && 
is_callable($property['Getter'])
                            && 
$property['Getter'] instanceof \Closure
                        
)
                        {
                            
$getter $property['Getter'];
                            
$property['Id'] = $id;
                            
$this->currentValues[$property['FieldName']] = $getter($this$property$currentActivity$compatible);
                        }
                        else
                        {
                            
$this->currentValues[$property['FieldName']] = $currentActivity['Properties'][$id];
                        }
                    }

                    if (
                        (
                            
$this->currentValues[$property['FieldName']] === null
                            
||
                            
$this->currentValues[$property['FieldName']] === ''
                        
)
                        && isset(
$property['Default'])
                    )
                    {
                        
$this->currentValues[$property['FieldName']] = $property['Default'];
                    }
                }
            }
        }

        if (
$compatible && $this->currentValues)
        {
            
$compatibleValues $this->currentValues;

            foreach (
$this->getMap() as $id => $property)
            {
                if (!isset(
$property['FieldName']))
                {
                    continue;
                }

                if (
$property['Type'] === FieldType::USER && !isset($property['Getter']))
                {
                    
$compatibleValues[$property['FieldName']] = \CBPHelper::usersArrayToString(
                        
$compatibleValues[$property['FieldName']],
                        
$this->getWorkflowTemplate(),
                        
$this->getDocumentType()
                    );
                }
            }

            return 
$compatibleValues;
        }

        return 
$this->currentValues;
    }