Skip to content
Snippets Groups Projects
dynamic-form.tmpl.php 1.27 KiB
Newer Older
<?php if ($form->getTitle()) { ?>
Jared Hancock's avatar
Jared Hancock committed
    <tr><th colspan="2">
        <em><strong><?php echo Format::htmlchars($form->getTitle()); ?></strong>:
        <?php echo Format::htmlchars($form->getInstructions()); ?></em>
    </th></tr>
    <?php
Jared Hancock's avatar
Jared Hancock committed
    foreach ($form->getFields() as $field) {
        ?>
        <tr><?php if ($field->isBlockLevel()) { ?>
                <td colspan="2">
                <?php
            }
            else { ?>
Jared Hancock's avatar
Jared Hancock committed
                <td class="multi-line <?php if ($field->get('required')) echo 'required'; ?>" style="min-width:120px;">
                <?php echo Format::htmlchars($field->get('label')); ?>:</td>
                <td><?php
            }
            $field->render(); ?>
Jared Hancock's avatar
Jared Hancock committed
            <?php if ($field->get('required')) { ?>
                <font class="error">*</font>
            <?php
            }
            if ($field->get('hint') && !$field->isBlockLevel()) { ?>
Jared Hancock's avatar
Jared Hancock committed
                <br /><em style="color:gray;display:inline-block"><?php
                    echo Format::htmlchars($field->get('hint')); ?></em>
            <?php
            }
            foreach ($field->errors() as $e) { ?>
                <br />
                <font class="error"><?php echo $e; ?></font>
            <?php } ?>
            </td>
        </tr>
        <?php
    }
?>