Custom Fields
Re-Envisioned
Support MB Blocks Creating a custom field populate with gravity forms and Gutenberg not working

  • Creator
    Topic
  • #28987
    Wilhem
    Participant

    Hi,

    I tried your code here, but nothing appears to be stored in db ;
    https://metabox.io/support/topic/select-a-gravity-form-to-assign-to-a-cpt/

    print_r($meta); is returning nothing

    $post_id = filter_input( INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT );is returning nothing

    Then, also for $saved_form = rwmb_get_value( .... ); which is NULL

    This is how I register the metabox :

    
    
        // WA Contact page
        $meta_boxes[] = [
            'title'          => esc_html__( '(WA) Contact', 'waff' ),
            'id'             => 'wa-contact',
            'fields'         => [
                [
                    'id'   => $prefix . 'c_title',
                    'type' => 'text',
                    'name' => esc_html__( 'Title', 'waff' ),
                    'placeholder' => esc_html__( 'Get in touch !', 'waff' ),
                ],
                [
                    'id'   => $prefix . 'c_content',
                    'type' => 'wysiwyg',
                    'name' => esc_html__( 'Rich content', 'waff' ),
                ],
            [
                    'id' => $prefix . 'c_form',
                    'type' => 'gform_select',
                    'name' => esc_html__( 'Select contact form', 'waff' ),
            ],
            ],
            'category'       => 'layout',
            'icon'           => 'text-page',
            'description'     => esc_html__( 'Display edito bloc', 'waff' ),
            'keywords'       => ['contact', 'post', 'text'],
            'supports'       => [
                'anchor'          => true,
                'customClassName' => true,
                'align'           => ['wide', 'full'],
            ],
            'render_callback' => 'WaffTwo\Blocks\wa_contact_callback',
            'type'           => 'block',
            'context'        => 'side',
        ];
    
    

    Thanks a lot,
    Best regards,
    Wilhem

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #28992
    Long Nguyen
    Moderator

    Hi,

    The plugin uses AJAX to call custom fields and the post ID is not passed to the block. The custom field type to get GF forms in a block might not work.

    I recommend using the custom field type in a regular meta box, not in a block to select GF forms and save data.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.