• Resolved hanitdm

    (@hanitdm)


    In the File “class-acf-field-clone.php” ,
    The Line 237 show the following mistake:

    public function acf_clone_clone_field( $field, $clone_field ) {

    I think this is a find & replace typo “acf_clone_clone_field” >>> Should be “acf_clone_field“, or try to fix it.

    Also, when fixded, there are more missed/bugs such as Line:244, where if ( $field[‘prefix_name‘] ) { , and prefix_name is not in the array. It seems that using the wrong code here, since fixing need better compare with the original previous version code!.

    Or, the function acf_clone_field() is completely missing!
    Thanks in advance

    • This topic was modified 2 weeks, 2 days ago by hanitdm.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter hanitdm

    (@hanitdm)

    This Function is completely missing from the last update of SCF!!!!!!!!!

        /**
         * This function is run when cloning a clone field
         * Important to run the acf_clone_field function on sub fields to pass on settings such as 'parent_layout'
         *
         * @type    function
         * @date    28/06/2016
         * @since   5.3.8
         *
         * @param   $field (array)
         * @param   $clone_field (array)
         * @return  $field
         */
        function acf_clone_field( $field, $clone_field ) {
    
            // bail early if this field is being cloned by some other kind of field (future proof)
            if ( $clone_field['type'] != 'clone' ) {
                return $field;
            }
    
            // backup (used later)
            // - backup only once (cloned clone fields can cause issues)
            if ( ! isset( $field['__key'] ) ) {
                $field['__key']   = $field['key'];
                $field['__name']  = $field['_name'];
                $field['__label'] = $field['label'];
            }
    
            // seamless
            if ( $clone_field['display'] == 'seamless' ) {
    
                // modify key
                // - this will allow sub clone fields to correctly load values for the same cloned field
                // - the original key will later be restored by acf/prepare_field allowing conditional logic JS to work
                $field['key'] = $clone_field['key'] . '_' . $field['key'];
    
                // modify prefix allowing clone field to save sub fields
                // - only used for parent seamless fields. Block or sub field's prefix will be overriden which also works
                $field['prefix'] = $clone_field['prefix'] . '[' . $clone_field['key'] . ']';
    
                // modify parent
                $field['parent'] = $clone_field['parent'];
    
                // label_format
                if ( $clone_field['prefix_label'] ) {
                    $field['label'] = $clone_field['label'] . ' ' . $field['label'];
                }
            }
    
            // prefix_name
            if ( $clone_field['prefix_name'] ) {
    
                // modify the field name
                // - this will allow field to load / save correctly
                $field['name'] = $clone_field['name'] . '_' . $field['_name'];
    
                // modify the field _name (orig name)
                // - this will allow fields to correctly understand the modified field
                if ( $clone_field['display'] == 'seamless' ) {
                    $field['_name'] = $clone_field['_name'] . '_' . $field['_name'];
                }
            }
    
            // required
            if ( $clone_field['required'] ) {
                $field['required'] = 1;
            }
    
            // type specific
            // note: seamless clone fields will not be triggered
            if ( $field['type'] == 'clone' ) {
                $field = $this->acf_clone_clone_field( $field, $clone_field );
            }
    
            // return
            return $field;
        }
    Plugin Author Brandon Kraft

    (@kraftbj)

    Code Wrangler

    Thanks for flagging. Can you check out beta 6 to confirm it resolves what you’re seeing?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.