Example #1
0
                <span class="adverts-form-required">*</span>
                <?php 
        }
        ?>
            </label>
            
            <?php 
        call_user_func(adverts_field_get_renderer($field), $field);
        ?>

            <?php 
    }
    ?>
            
            <?php 
    if (adverts_field_has_errors($field)) {
        ?>
            <ul class="adverts-field-error-list">
                <?php 
        foreach ($field["error"] as $k => $v) {
            ?>
                <li><?php 
            esc_html_e($v);
            ?>
</li>
                <?php 
        }
        ?>
            </ul>
            <?php 
    }
Example #2
0
/**
 * Layout for forms generated by Adverts in wp-admin panel.
 * 
 * @param Adverts_Form $form
 * @param array $options
 * @since 0.1
 * @return void
 */
function adverts_form_layout_config(Adverts_Form $form, $options = array())
{
    $a = array();
    ?>

    <?php 
    foreach ($form->get_fields(array("type" => array("adverts_field_hidden"))) as $field) {
        ?>
    <?php 
        call_user_func(adverts_field_get_renderer($field), $field);
        ?>
    <?php 
    }
    ?>
    
    <?php 
    foreach ($form->get_fields($options) as $field) {
        ?>
        <?php 
        if ($field["type"] == "adverts_field_header") {
            ?>
        <tr valign="top">
            <th colspan="2" style="padding-bottom:0px">
                <h3 style="border-bottom:1px solid #dfdfdf; line-height:1.4em; font-size:15px"><?php 
            esc_html_e($field["title"]);
            ?>
</h3>
            </th>
        </tr>
        <?php 
        } else {
            ?>
        <tr valign="top" class="<?php 
            if (adverts_field_has_errors($field)) {
                ?>
adverts-field-error<?php 
            }
            ?>
">
            <th scope="row">
                <label <?php 
            if (!in_array($field['type'], $a)) {
                ?>
for="<?php 
                esc_attr_e($field["name"]);
                ?>
"<?php 
            }
            ?>
>
                    <?php 
            esc_html_e($field["label"]);
            ?>
                    <?php 
            if (adverts_field_has_validator($field, "is_required")) {
                ?>
<span class="adverts-red">&nbsp;*</span><?php 
            }
            ?>
                </label>
            </th>
            <td class="">
                
                <?php 
            switch ($field["type"]) {
                case "adverts_field_text":
                    $field["class"] = (isset($field["class"]) ? $field["class"] : '') . ' regular-text';
                    break;
            }
            ?>
                
                <?php 
            call_user_func(adverts_field_get_renderer($field), $field);
            ?>

                <?php 
            if (isset($field['hint']) && !empty($field['hint'])) {
                ?>
                <br/><span class="description"><?php 
                echo $field['hint'];
                ?>
</span>
                <?php 
            }
            ?>

                <?php 
            if (adverts_field_has_errors($field)) {
                ?>
                <ul class="updated adverts-error-list">
                    <?php 
                foreach ($field["error"] as $k => $v) {
                    ?>
                    <li><?php 
                    esc_html_e($v);
                    ?>
</li>
                    <?php 
                }
                ?>
                </ul>
                <?php 
            }
            ?>
            </td>
        </tr>
        <?php 
        }
        ?>
    <?php 
    }
    ?>

<?php 
}