protected function normalizeFieldDefs($fields, $step)
    {
        $convertedFields = [];
        $i = 0;
        // the 'easy' yml: key = field name, value = value
        // deprecated: the 'legacy' yml: key = numerical index, value = array ( field name => value )
        foreach ($fields as $key => $field) {
            if ($key === $i && is_array($field) && count($field) == 1) {
                // each $field is one key value pair
                // eg.: $field = array($fieldIdentifier => $fieldValue)
                reset($field);
                $fieldIdentifier = key($field);
                $fieldValue = $field[$fieldIdentifier];

                $convertedFields[$fieldIdentifier] = $fieldValue;
            } else {
                $convertedFields[$key] = $field;
            }
            $i++;
        }

        // transform single-language field defs in multilang ones
        if (!$this->hasLanguageCodesAsKeys($convertedFields)) {
            $language = $this->getLanguageCode($step);

            foreach ($convertedFields as $fieldIdentifier => $fieldValue) {
                $convertedFields[$fieldIdentifier] = array($language => $fieldValue);
            }
        }

        return $convertedFields;
    }
protected function normalizeFieldDefs($fields, $step)
    {
        $convertedFields = [];
        $i = 0;
        // the 'easy' yml: key = field name, value = value
        // deprecated: the 'legacy' yml: key = numerical index, value = array ( field name => value )
        foreach ($fields as $key => $field) {
            if ($key === $i && is_array($field) && count($field) == 1) {
                // each $field is one key value pair
                // eg.: $field = array($fieldIdentifier => $fieldValue)
                reset($field);
                $fieldIdentifier = key($field);
                $fieldValue = $field[$fieldIdentifier];

                $convertedFields[$fieldIdentifier] = $fieldValue;
            } else {
                $convertedFields[$key] = $field;
            }
            $i++;
        }

        // transform single-language field defs in multilang ones
        if (!$this->hasLanguageCodesAsKeys($convertedFields)) {
            $language = $this->getLanguageCode($step);

            foreach ($convertedFields as $fieldIdentifier => $fieldValue) {
                $convertedFields[$fieldIdentifier] = array($language => $fieldValue);
            }
        }

        return $convertedFields;
    }
protected function normalizeFieldDefs ( $ fields , $ step ) { $ convertedFields = [ ] ; $ i = 0 ; // the 'easy' yml: key = field name, value = value // deprecated: the 'legacy' yml: key = numerical index, value = array ( field name => value ) foreach ( $ fields as $ key => $ field ) { if ( $ key === $ i && is_array ( $ field ) && count ( $ field ) == 1 ) { // each $field is one key value pair // eg.: $field = array($fieldIdentifier => $fieldValue) reset ( $ field ) ; $ fieldIdentifier = key ( $ field ) ; $ fieldValue = $ field [ $ fieldIdentifier ] ; $ convertedFields [ $ fieldIdentifier ] = $ fieldValue ; } else { $ convertedFields [ $ key ] = $ field ; } $ i ++ ; } // transform single-language field defs in multilang ones if ( ! $ this -> hasLanguageCodesAsKeys ( $ convertedFields ) ) { $ language = $ this -> getLanguageCode ( $ step ) ; foreach ( $ convertedFields as $ fieldIdentifier => $ fieldValue ) { $ convertedFields [ $ fieldIdentifier ] = array ( $ language => $ fieldValue ) ; } } return $ convertedFields ; }
Helper function to accommodate the definition of fields
- using a legacy DSL version
- using either single-language or multi-language style

@param array $fields
@return array
Helper function to accommodate the definition of fields - using a legacy DSL version - using either single - language or multi - language style