Date::renderControlMultiple: Bitrix method

      
<?php 
//  Bitrix\Bizproc\BaseType\Date :: renderControlMultiple()
//  /dist/bitrix/modules/bizproc/lib/basetype/date.php:224

    
public static function renderControlMultiple(FieldType $fieldType, array $field$value$allowSelection$renderMode)
    {
        
$allowSelectionOrig $allowSelection;
        if (
$renderMode FieldType::RENDER_MODE_PUBLIC)
        {
            
$allowSelection false;
        }

        if (!
is_array($value) || is_array($value) && \CBPHelper::isAssociativeArray($value))
        {
            
$value = array($value);
        }

        
$selectorValue null;
        if (
$allowSelection)
        {
            foreach (
$value as $k => $v)
            {
                if (\
CBPActivity::isExpression($v))
                {
                    
$selectorValue $v;
                    unset(
$value[$k]);
                }
            }
            
$value array_values($value);
        }

        if (empty(
$value))
        {
            
$value[] = null;
        }

        
$controls = [];

        foreach (
$value as $k => $v)
        {
            
$singleField $field;
            
$singleField['Index'] = $k;
            
$controls[] = static::renderControl(
                
$fieldType,
                
$singleField,
                
$v,
                
$allowSelectionOrig,
                
$renderMode
            
);
        }

        if (
$renderMode FieldType::RENDER_MODE_PUBLIC)
        {
            
$renderResult = static::renderPublicMultipleWrapper($fieldType$field$controls);
        }
        else
        {
            
$renderResult = static::wrapCloneableControls($controls, static::generateControlName($field));
        }

        if (
$allowSelection)
        {
            
$renderResult .= static::renderControlSelector($field$selectorValuetrue''$fieldType);
        }

        return 
$renderResult;
    }