Home>Support>Render “builder” Form Field in Template?

Render “builder” Form Field in Template?

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

Hey,

I’m trying to use the “builder” Form Field Type to let the user use the page builder layout inside a widget. On the backend this works perfectly, but how do I render it in the template?

That’s my form array:

'heading' => array(
    'type' => 'text',
    'label' => 'Name',
),

'content' => array(
    'type' => 'builder',
    'label' => 'Akkordion-Inhalt',
),

'already_opened' => array(
    'type' => 'checkbox',
    'label' => 'Schon geƶffnet?',
    'default' => false
),
'last' => array(
    'type' => 'checkbox',
    'label' => 'Letztes Element?',
    'default' => false
)

And here’s the (simplified) Template:

<div class="accordion-section <?php if($instance['last']) { echo "last margin-bottom"; }?>">
    <div class="accordion-section-header <?php echo $section_header_color;?> <?php if($instance['already_opened']) { echo "active"; }?>">
        <h2><?php echo $instance['heading'];?></h2>
        <div class="accordion-section-header-arrow"></div>
    </div>

    <div class="accordion-section-content">
        <div class="content-part">
            <?php echo $instance['akkordeon_content'];?>
        </div>
    </div>
</div>

But

$instance['akkordeon_content'];
is an array containing all the widgets etc. used in the backend … how do I render that?

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 8 years, 7 months ago Alex S
    Hi, I Work Here

    Hi Andreas,

    You’ll need to use siteorigin_panels_render() to render it. For more information please refer to siteorigin_panels_render() and the layout slider for an example.

  2. 8 years, 7 months ago Andreas Neubert

    Awesome, thanks a lot!

  3. 8 years, 7 months ago Alex S
    Hi, I Work Here

    Hi Andreas,

    Happy to help mate. :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More