Support

Account

Home Forums Gutenberg Creating a new custom field type – how to handle data

Unread

Creating a new custom field type – how to handle data

  • Hi guys,
    I trying to create a new custom field type, where the user can click on an image and there by create a point on that image (X and Y). The point is represented in the two input fields underneath the image.

    So far, I have downloaded the ACF Field Type starter-kit and added the image and the input fields to the frontend, but I need to understand how to save data and pass data around in from javascript to php (class-XXX-field-XXX-v5.php)

    In the render_field_settings function I’ve added point_x and point_y to hold the two values, but I dont know if that is right?

    
    acf_render_field_setting( $field, array(
    			'label'			=> __('Point X','acf-overlay-point'),
    			'instructions'	=> __('Customise the X point','acf-overlay-point'),
    			'type'			=> 'number',
    			'name'			=> 'point_X',
    		));
    

    and

    
    acf_render_field_setting( $field, array(
    			'label'			=> __('Point Y','acf-overlay-point'),
    			'instructions'	=> __('Customise the Y point','acf-overlay-point'),
    			'type'			=> 'number',
    			'name'			=> 'point_Y',
    		));
    

    Or maybe a good tutorial?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.