Support

Account

Home Forums General Issues Creating a new field type using an existing field type as foundation

Unread

Creating a new field type using an existing field type as foundation

  • I am attempting to create a new field that accesses the image and page link field types in ACF Pro as

    <?php function render_field($field){ ?>
        <?php
            do_action('acf/render_field/type=page_link', array(                        
                'name' => $field_name . '[page_id]',
                'value' => $field['value']['page_id']
             ));                                    
        ?>
     <?php
            do_action('acf/render_field/type=image', array(                        
                'name' => $field_name . '[page_id]',
                'value' => $field['value']['page_id']
             ));                                    
        ?>
    <?php }
    

    This gets the field to load on the edit screen in WP, but the necessary JS is missing to:

    a/ get an ajax list of the posts in a select2 field (or any list for that matter)
    b/ get the wp media lightbox/upload prompt to load on click

    I know how to tie into custom JS actions, but need the specific JS to include to get the above to work.

    Any help on this would be greatly appreciated

Viewing 1 post (of 1 total)

The topic ‘Creating a new field type using an existing field type as foundation’ is closed to new replies.