This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Render “builder” Form Field in Template?

9 years ago · Last reply by Alex S 9 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

3
  1. Alex S Staff 9 years, 3 months ago

    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. Andreas Neubert 9 years, 3 months ago

    Awesome, thanks a lot!

  3. Alex S Staff 9 years, 3 months ago

    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.

Have a different question or issue?

Start New Thread