<?php
/**
 * Admin section for form list and removal
 *
 * @category Forms
 * @package  Mtc_Form_Builder
 * @author   mtc. Martins Fridenbergs <martins.fridenbergs@mtcmedia.co.uk>
 */

namespace Mtc\Modules\FormBuilder\Classes;

$path = '../../../';
require_once $path . 'core/includes/header.inc.php';

// Create an iframe content si
if (empty($_REQUEST['iframe_present'])) {
    ?>
    <iframe src="<?= $_SERVER['PHP_SELF'] ?>?iframe_present=1" class="previewIframe"></iframe>
    <?php
    exit;
} else {
    echo $twig->render(
        'FormBuilder/render.form.twig',
        [
            'form' => $_SESSION['preview_data'],
            'preview' => true,
            'template' => 'default'
        ]
    );
    exit;
}
