Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Meta_Box_Voucher::codes_section_html()

Retrieve the HTML for the codes area.


Return Return

(string)


Top ↑

Source Source

File: includes/admin/post-types/meta-boxes/class.llms.meta.box.voucher.php

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
* @return string
 */
private function codes_section_html() {
 
    global $post;
    $voucher     = new LLMS_Voucher( $post->ID );
    $codes       = $voucher->get_voucher_codes();
    $delete_icon = '<span class="dashicons dashicons-no"></span><span class="screen-reader-text">' . __( 'Delete', 'lifterlms' ) . '</span>';
 
    ob_start(); ?>
    <div class="llms-voucher-codes-wrapper" id="llms-form-wrapper">
        <table>
 
            <thead>
            <tr>
                <th></th>
                <th>Code</th>
                <th>Uses</th>
                <th>Actions</th>
            </tr>
            </thead>
 
            <script>var delete_icon = '<?php echo $delete_icon; ?>';</script>
 
            <tbody id="llms_voucher_tbody">
            <?php
            if ( ! empty( $codes ) ) :
                foreach ( $codes as $code ) :
                    ?>
                    <tr>
                        <td></td>
                        <td>
                            <input type="text" maxlength="20" placeholder="Code" value="<?php echo esc_attr( $code->code ); ?>" name="llms_voucher_code[]">
                            <input type="hidden" name="llms_voucher_code_id[]" value="<?php echo esc_attr( $code->id ); ?>">
                        </td>
                        <td>
                            <span><?php echo esc_html( $code->used ); ?> / </span><input type="number" min="1" value="<?php echo esc_attr( $code->redemption_count ); ?>" placeholder="Uses" class="llms-voucher-uses" name="llms_voucher_uses[]">
                        </td>
                        <td>
                            <a href="#" data-id="<?php echo esc_attr( $code->id ); ?>" class="llms-voucher-delete">
                                <?php echo $delete_icon; ?>
                            </a>
                        </td>
                    </tr>
                    <?php
                endforeach;
            endif;
            ?>
            </tbody>
 
        </table>
 
        <div class="llms-voucher-add-codes">
            <p>Add <input type="number" max="50" placeholder="#" id="llms_voucher_add_quantity"> new code(s) with <input
                    type="number" placeholder="#" id="llms_voucher_add_uses"> use(s) per code
                <button id="llms_voucher_add_codes" class="button-primary">Add</button>
            </p>
        </div>
 
        <input type="hidden" name="delete_ids" id="delete_ids">
    </div>
 
    <?php
    return ob_get_clean();


Top ↑

Changelog Changelog

Changelog
Version Description
4.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.