• Resolved RubenZuidervaart

    (@rubenfonteyn)


    Hello,

    I’ve just installed this extension, and despite it working well there’s a little bug when you’re loading the field into a variable.
    Because instead of placing the field into a variable, the field gets displayed immediately.

    It doesn’t matter if the field is inside a group or anything, as soon as it’s called it just forces itself onto the front-end.

    For example:
    Here I’m just preparing a few values to be thrown into the content, with a default fallback. The “cta_form_block” is a group, and has the form in it. As soon as the group is stored into the variable it’s forcing the form to be displayed.

    //Get the page content
    $page_form_content = get_field('cta_form_block'); //Here it's already being displayed
    
        //Setup new empty fields
        $form_title         = '';
        $form_description   = '';
        $form_form          = '';
    
        //Fill the content
        if( $page_form_content ): //Enter group
    
            $form_title         = $page_form_content['title'];
            $form_description   = $page_form_content['description'];
            $form_form          = $page_form_content['form'];
    
        else:
    
            $form_title         = $default_title;
            $form_description   = $default_description;
            $form_form          = $default_form;
    
        endif;
    
    ?>

    I then figured I might try to make it it’s own field, so I gave it it’s own field. Like so:
    $page_form_form = get_field('cta_form_form');

    That’ll also immediately display the form.

    So now I’ll just call the field directly in the content, while I’m generally trying to keep the logic and content seperated as much as possible.

    It’s not a dramatic issue, but I thought that it’d be good for you guys to know about this.

Viewing 1 replies (of 1 total)
  • Plugin Author KrishaWeb

    (@krishaweb)

    Hello @rubenfonteyn

    Thank you for your idea.

    we have implemented it by giving a filter. Please check the updated version of the plugin and try with it. Let us know whether it worked or not.

    Thank you

Viewing 1 replies (of 1 total)

The topic ‘Field loaded when placed into variable’ is closed to new replies.