Support

Account

Home Forums Gutenberg How to transfer form Gutenberg-Block to another ACF-Field

Helping

How to transfer form Gutenberg-Block to another ACF-Field

  • Hi

    I have registered an ACF field as a Gutenberg-Block.

    add_action('acf/init', 'my_acf_init');
    function my_acf_init() {  
        if( function_exists('acf_register_block_type') ) {
            acf_register_block_type(array(
                'name'                => 'event-date',
                'title'                => __('Veranstaltungs-Datum'),
                'description'            => __('Veranstaltungs-Datum'),
                'render_template'   => 'block-rendering/events_date.php',
                'icon'                => 'format-image',
                'keywords'            => array( 'Event' ),
                'mode'                 => 'edit',
                'supports'          => array('multiple' => false, 'className' => true ), 
                'post_types' => array('events',),
            ));
     
        }    
    }  

    It is a repeater field with a date picker (and other fields).
    Is there a way to automatically transfer the date from the Gutenberg block to another ACF field (not registered as a block)?

    Thank you all!
    Matthias

  • In simple case You can:

    1. Add ID or Class to the fields: date sub-field and destination field. You can do it when edit field group
    2. Use JS to synchronize values – example: https://codepen.io/uxbox/pen/VwvOXwL
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.