Support

Account

Home Forums Add-ons Flexible Content Field Merge/combine two flexible content fields into one Reply To: Merge/combine two flexible content fields into one

  • I kinda did that, BUT it’s saving to JSON … which should be preventable?

    Code for other:

    add_filter( 'acf/load_field/name=blocks_content', array( $this, 'add_more_layouts' ), 10, 1 );
    
    public function add_more_layouts( $field ) {
        $add_layouts = array();
    
        $more_layouts = acf_get_field( 'more_layouts' );
        if( ! empty( $more_layouts[ 'layouts' ] ) ) {
            $add_layouts = array_merge( $add_layouts, $more_layouts[ 'layouts' ] );
        }
    
        if( ! empty( $add_layouts ) ) {
            $field[ 'layouts' ] = array_merge( $field[ 'layouts' ], $add_layouts );
        }
    
        return $field;
    }