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)

The topic ‘Creating a new custom field type – how to handle data’ is closed to new replies.