function prepare_form()

in web/wp-content/plugins/acf-extended/includes/modules/form/module-form-deprecated.php [715:954]


    function prepare_form($item){
    
        /**
         * render
         */
        $render = '';
        
        if(!empty($item['custom_html_enabled']) && !empty($item['custom_html'])){
            $render = $item['custom_html'];
        }
    
        // generate render
        if(!empty($item['html_before_fields']) || !empty($item['html_after_fields'])){
        
            // empty render
            // use {render:fields}
            if(empty($render)){
                $render = '{render:fields}';
            }
        
            // prepend before render
            if(!empty($item['html_before_fields'])){
                $render = $item['html_before_fields'] . "\n\n" . $render;
            }
        
            // append before render
            if(!empty($item['html_after_fields'])){
                $render = $render . "\n\n" . $item['html_after_fields'];
            }
        
        }
        
        // deprecated {field_group:group_61642cb824d8a}
        if(strpos($render, '{field:') !== false){
            _deprecated_function('ACF Extended: {field:field_625e53aa1a791} template tag in form render', '0.9', 'the template tag {render:field_625e53aa1a791}');
            $render = str_replace('{field:', '{render:', $render);
        }
    
        // deprecated {field_group:group_61642cb824d8a} to render field
        if(strpos($render, '{field_group:') !== false){
            _deprecated_function('ACF Extended: {field_group:group_61642cb824d8a} template tag in form render', '0.9', 'the template tag {render:group_61642cb824d8a}');
            $render = str_replace('{field_group:', '{render:', $render);
        }
    
        if(isset($item['custom_html_enabled'])){
            _deprecated_function('ACF Extended: "custom_html_enabled" form argument', '0.9', 'the "render" argument');
        }
        
        if(isset($item['custom_html'])){
            _deprecated_function('ACF Extended: "custom_html" form argument', '0.9', 'the "render" argument');
        }
        
        if(isset($item['html_before_fields'])){
            _deprecated_function('ACF Extended: "html_before_fields" form argument', '0.9', 'the "render" argument');
        }
        
        if(isset($item['html_after_fields'])){
            _deprecated_function('ACF Extended: "html_after_fields" form argument', '0.9', 'the "render" argument');
        }
        
        // cleanup keys
        unset($item['custom_html_enabled'], $item['custom_html'], $item['html_before_fields'], $item['html_after_fields']);
    
        // assign form render
        if(!empty($render)){
            $item['render'] = $render;
        }
    
        /**
         * attributes
         */
        if(isset($item['form_submit'])){
            _deprecated_function('ACF Extended: "form_submit" form argument', '0.9');
            unset($item['form_submit']);
        }
    
        if(isset($item['submit_value'])){
            _deprecated_function('ACF Extended: "submit_value" form argument', '0.9', 'the "attributes > submit > value" argument');
            $item['attributes']['submit']['value'] = $item['submit_value'];
            unset($item['submit_value']);
        }
    
        if(isset($item['html_submit_button'])){
            _deprecated_function('ACF Extended: "html_submit_button" form argument', '0.9', 'the "attributes > submit > button" argument');
            $item['attributes']['submit']['button'] = $item['html_submit_button'];
            unset($item['html_submit_button']);
        }
    
        if(isset($item['html_submit_spinner'])){
            _deprecated_function('ACF Extended: "html_submit_spinner" form argument', '0.9', 'the "attributes > submit > spinner" argument');
            $item['attributes']['submit']['spinner'] = $item['html_submit_spinner'];
            unset($item['html_submit_spinner']);
        }
    
        if(isset($item['field_el'])){
            _deprecated_function('ACF Extended: "field_el" form argument', '0.9', 'the "attributes > fields > element" argument');
            $item['attributes']['fields']['element'] = $item['field_el'];
            unset($item['field_el']);
        }
    
        if(isset($item['fields_attributes']['wrapper_class'])){
            _deprecated_function('ACF Extended: "fields_attributes > wrapper_class" form argument', '0.9', 'the "attributes > fields > wrapper_class" argument');
            $item['attributes']['fields']['wrapper_class'] = $item['fields_attributes']['wrapper_class'];
            unset($item['fields_attributes']['wrapper_class']);
        }
    
        if(isset($item['fields_attributes']['class'])){
            _deprecated_function('ACF Extended: "fields_attributes > class" form argument', '0.9', 'the "attributes > fields > class" argument');
            $item['attributes']['fields']['class'] = $item['fields_attributes']['class'];
            unset($item['fields_attributes']['class']);
        }
    
        if(isset($item['fields_attributes'])){
            _deprecated_function('ACF Extended: "fields_attributes" form argument', '0.9', 'the "attributes > fields" argument');
            unset($item['fields_attributes']);
        }
    
        if(isset($item['form'])){
            _deprecated_function('ACF Extended: "form" form argument', '0.9', 'the "attributes > form > element" argument');
            $item['attributes']['form']['element'] = $item['form'] ? 'form' : 'div';
            unset($item['form']);
        }
    
        if(isset($item['form_attributes']['id'])){
            _deprecated_function('ACF Extended: "form_attributes > id" form argument', '0.9', 'the "attributes > form > id" argument');
            $item['attributes']['form']['id'] = $item['form_attributes']['id'];
            unset($item['form_attributes']['id']);
        }
    
        if(isset($item['form_attributes']['class'])){
            _deprecated_function('ACF Extended: "form_attributes > class" form argument', '0.9', 'the "attributes > form > class" argument');
            $item['attributes']['form']['class'] = $item['form_attributes']['class'];
            unset($item['form_attributes']['class']);
        }
    
        if(isset($item['form_attributes'])){
            _deprecated_function('ACF Extended: "form_attributes" form argument', '0.9', 'the "attributes > form" argument');
            unset($item['form_attributes']);
        }
    
        /**
         * validation
         */
        if(isset($item['hide_error'])){
            _deprecated_function('ACF Extended: "hide_error" form argument', '0.9', 'the "validation > hide_error" argument');
            $item['validation']['hide_error'] = $item['hide_error'];
            unset($item['hide_error']);
        }
    
        if(isset($item['hide_unload'])){
            _deprecated_function('ACF Extended: "hide_unload" form argument', '0.9', 'the "validation > hide_unload" argument');
            $item['validation']['hide_unload'] = $item['hide_unload'];
            unset($item['hide_unload']);
        }
    
        if(isset($item['hide_revalidation'])){
            _deprecated_function('ACF Extended: "hide_revalidation" form argument', '0.9', 'the "validation > hide_revalidation" argument');
            $item['validation']['hide_revalidation'] = $item['hide_revalidation'];
            unset($item['hide_revalidation']);
        }
    
        if(isset($item['errors_position'])){
            _deprecated_function('ACF Extended: "errors_position" form argument', '0.9', 'the "validation > errors_position" argument');
            $item['validation']['errors_position'] = $item['errors_position'];
            unset($item['errors_position']);
        }
    
        if(isset($item['errors_class'])){
            _deprecated_function('ACF Extended: "errors_class" form argument', '0.9', 'the "validation > errors_class" argument');
            $item['validation']['errors_class'] = $item['errors_class'];
            unset($item['errors_class']);
        }
    
        /**
         * success
         */
        if(isset($item['updated_message'])){
            _deprecated_function('ACF Extended: "updated_message" form argument', '0.9', 'the "success > message" argument');
            $item['success']['message'] = $item['updated_message'];
            unset($item['updated_message']);
        }
    
        if(isset($item['html_updated_message'])){
            _deprecated_function('ACF Extended: "html_updated_message" form argument', '0.9', 'the "success > wrapper" argument');
            $item['success']['wrapper'] = $item['html_updated_message'];
            unset($item['html_updated_message']);
        }
    
        if(isset($item['updated_hide_form'])){
            _deprecated_function('ACF Extended: "updated_hide_form" form argument', '0.9', 'the "success > hide_form" argument');
            $item['success']['hide_form'] = $item['updated_hide_form'];
            unset($item['updated_hide_form']);
        }
        
        if(isset($item['return'])){
            _deprecated_function('ACF Extended: "Redirection" form setting', '0.8.7.5', "the Redirect Action (See documentation: https://www.acf-extended.com/features/modules/dynamic-forms)");
        }
    
        /**
         * settings
         */
        if(isset($item['field_groups_rules'])){
            _deprecated_function('ACF Extended: "field_groups_rules" form argument', '0.9', 'the "settings > location" argument');
            $item['settings']['location'] = $item['field_groups_rules'];
            unset($item['field_groups_rules']);
        }
        
        if(isset($item['honeypot'])){
            _deprecated_function('ACF Extended: "honeypot" form argument', '0.9', 'the "settings > honeypot" argument');
            $item['settings']['honeypot'] = $item['honeypot'];
            unset($item['honeypot']);
        }
    
        if(isset($item['kses'])){
            _deprecated_function('ACF Extended: "kses" form argument', '0.9', 'the "settings > kses" argument');
            $item['settings']['kses'] = $item['kses'];
            unset($item['kses']);
        }
    
        if(isset($item['uploader'])){
            _deprecated_function('ACF Extended: "uploader" form argument', '0.9', 'the "settings > uploader" argument');
            $item['settings']['uploader'] = $item['uploader'];
            unset($item['uploader']);
        }
    
        if(isset($item['label_placement'])){
            _deprecated_function('ACF Extended: "label_placement" form argument', '0.9', 'the "attributes > field > label" argument');
            $item['attributes']['fields']['label'] = $item['label_placement'];
            unset($item['label_placement']);
        }
        
        if(isset($item['instruction_placement'])){
            _deprecated_function('ACF Extended: "instruction_placement" form argument', '0.9', 'the "attributes > fields > instruction" argument');
            $item['attributes']['fields']['instruction'] = $item['instruction_placement'];
            unset($item['instruction_placement']);
        }
        
        return $item;
        
    }