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
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | */ 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. |