Hi,
it did work via the old
acf_register_block_type
function and global php variables.
But with the new register_acf_blocks the global php variables seem not to work anymore.
I think this is because the php files are not “connected” anymore.
So f there is not wp trick something for this the only two solutions I can imagine are cookies or javascript.
@jhned: great piece of code! Thanks for sharing!
@johnnya23: I made a screenshot of the settings. You have to replace the field keys (“Schlüssel”). To see them go to configure view on the top right and activate field keys.
The select field is a Post-Object field which returns the id of the selected post. Multiple selection is active.
In my example the layouts field is called layout. So you have to replace “layouts” to “layout” here:
// Get the layouts value from the selected page.
$layouts_from_page = get_field_object( ‘layouts’, $page_id, false, true );
In Gutenberg you have to reload the page after saving to see the copied fields.
Full resolution image
Hi John,
thanks your your reply!
It seems like the plugins are not the problem. I installed the same on my test system without issues.
Is it possible that there are some right issues when uploading the json file? Do you know to wich directory the json file is uploaded before the import?