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;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.