LLMS_Meta_Box_Voucher::get_fields()
Builds array of metabox options.
Description Description
Array is called in output method to display options. Appropriate fields are generated based on type.
Return Return
(array)
Source Source
File: includes/admin/post-types/meta-boxes/class.llms.meta.box.voucher.php
*/ public function get_fields() { $voucher = new LLMS_Voucher( $this->post->ID ); $selected_couses = $voucher->get_products( 'course' ); $selected_memberships = $voucher->get_products( 'llms_membership' ); return array( array( 'title' => __( 'General', 'lifterlms' ), 'fields' => array( array( 'data_attributes' => array( 'post-type' => 'course', 'post-statuses' => 'publish,draft,future', 'placeholder' => __( 'Courses', 'lifterlms' ), ), 'type' => 'select', 'label' => __( 'Courses', 'lifterlms' ), 'id' => $this->prefix . 'voucher_courses', 'class' => 'input-full llms-select2-post', 'selected' => $selected_couses, 'value' => llms_make_select2_post_array( $selected_couses ), 'multi' => true, ), array( 'data_attributes' => array( 'post-type' => 'llms_membership', 'post-statuses' => 'publish,draft,future', 'placeholder' => __( 'Memberships', 'lifterlms' ), ), 'type' => 'select', 'label' => __( 'Membership', 'lifterlms' ), 'id' => $this->prefix . 'voucher_membership', 'class' => 'input-full llms-select2-post', 'selected' => $selected_memberships, 'value' => llms_make_select2_post_array( $selected_memberships ), 'multi' => true, ), array( 'type' => 'custom-html', 'label' => __( 'Codes', 'lifterlms' ), 'id' => '', 'class' => '', 'value' => self::codes_section_html(), ), ), ), array( 'title' => __( 'Redemptions', 'lifterlms' ), 'fields' => array( array( 'type' => 'custom-html', 'label' => __( 'Redemptions', 'lifterlms' ), 'id' => '', 'class' => '', 'value' => self::redemption_section_html(), ), ), ), );
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.35.0 | Add relevant placeholders on the course/membership select fields. |
3.32.0 | Vouchers can now be restricted also to a draft or scheduled Course/Membership |
3.0.0 | Introduced. |