コード例 #1
0
ファイル: PodsMeta.php プロジェクト: centaurustech/chipin
    /**
     * @param $comment
     * @param $metabox
     */
    public function meta_comment($comment, $metabox)
    {
        wp_enqueue_style('pods-form');
        $hidden_fields = array();
        ?>
    <table class="form-table editcomment pods-metabox">
        <?php 
        $id = null;
        if (is_object($comment)) {
            $id = $comment->comment_ID;
        }
        $pod = pods($metabox['args']['group']['pod']['name'], $id, true);
        foreach ($metabox['args']['group']['fields'] as $field) {
            if (false === PodsForm::permission($field['type'], $field['name'], $field, $metabox['args']['group']['fields'], $pod, $id)) {
                if (pods_var('hidden', $field['options'], false, null, true)) {
                    $field['type'] = 'hidden';
                } else {
                    continue;
                }
            } elseif (!pods_has_permissions($field['options']) && pods_var('hidden', $field['options'], false, null, true)) {
                $field['type'] = 'hidden';
            }
            $value = '';
            if (!empty($pod)) {
                $value = $pod->field(array('name' => $field['name'], 'in_form' => true));
            }
            if ('hidden' == $field['type']) {
                $hidden_fields[] = array('field' => $field, 'value' => $value);
            } else {
                ?>
            <tr class="form-field pods-field <?php 
                echo 'pods-form-ui-row-type-' . $field['type'] . ' pods-form-ui-row-name-' . Podsform::clean($field['name'], true);
                ?>
">
                <th scope="row" valign="top"><?php 
                echo PodsForm::label('pods_meta_' . $field['name'], $field['label'], $field['help'], $field);
                ?>
</th>
                <td>
                    <?php 
                echo PodsForm::field('pods_meta_' . $field['name'], $value, $field['type'], $field, $pod, $id);
                ?>
                    <?php 
                echo PodsForm::comment('pods_meta_' . $field['name'], $field['description'], $field);
                ?>
                </td>
            </tr>
        <?php 
            }
        }
        ?>
    </table>
<?php 
        foreach ($hidden_fields as $hidden_field) {
            $field = $hidden_field['field'];
            echo PodsForm::field('pods_meta_' . $field['name'], $hidden_field['value'], 'hidden');
        }
    }
コード例 #2
0
ファイル: form.php プロジェクト: centaurustech/chipin
    }
    echo apply_filters('pods_meta_default_box_title', $title, $pod, $fields);
    ?>
                                </span>
                            </h3>

                            <div class="inside">
                                <table class="form-table pods-metabox">
                                    <?php 
    foreach ($fields as $field) {
        if ('hidden' == $field['type']) {
            continue;
        }
        ?>
                                        <tr class="form-field pods-field <?php 
        echo 'pods-form-ui-row-type-' . $field['type'] . ' pods-form-ui-row-name-' . Podsform::clean($field['name'], true);
        ?>
">
                                            <th scope="row" valign="top"><?php 
        echo PodsForm::label('pods_field_' . $field['name'], $field['label'], $field['help'], $field);
        ?>
</th>
                                            <td>
                                                <?php 
        echo PodsForm::field('pods_field_' . $field['name'], $pod->field(array('name' => $field['name'], 'in_form' => true)), $field['type'], $field, $pod, $pod->id());
        ?>
                                                <?php 
        echo PodsForm::comment('pods_field_' . $field['name'], $field['description'], $field);
        ?>
                                            </td>
                                        </tr>