| 1 |
<?php |
| 2 |
/** |
| 3 |
* Merchant - Product Labels |
| 4 |
*/ |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; // Exit if accessed directly |
| 8 |
} |
| 9 |
|
| 10 |
/** |
| 11 |
* Settings |
| 12 |
*/ |
| 13 |
Merchant_Admin_Options::create( array( |
| 14 |
'title' => esc_html__( 'Settings', 'merchant' ), |
| 15 |
'module' => 'product-labels', |
| 16 |
'fields' => array( |
| 17 |
|
| 18 |
array( |
| 19 |
'id' => 'label_text', |
| 20 |
'type' => 'text', |
| 21 |
'title' => esc_html__( 'Label text', 'merchant' ), |
| 22 |
'desc' => esc_html__( 'Note: This label will be shown only on sales products.', 'merchant' ), |
| 23 |
'default' => esc_html__( 'Spring Special', 'merchant' ), |
| 24 |
), |
| 25 |
|
| 26 |
array( |
| 27 |
'id' => 'display_percentage', |
| 28 |
'type' => 'checkbox', |
| 29 |
'label' => esc_html__( 'Display Sale Percentage', 'merchant' ), |
| 30 |
'default' => 0 |
| 31 |
), |
| 32 |
|
| 33 |
array( |
| 34 |
'id' => 'percentage_text', |
| 35 |
'type' => 'text', |
| 36 |
'title' => esc_html__( 'Sale percentage text', 'merchant' ), |
| 37 |
'desc' => esc_html__( 'You may use the {value} tag. E.g. <strong>{value}% OFF!</strong>', 'merchant' ), |
| 38 |
'default' => '-{value}%', |
| 39 |
'condition' => array( 'display_percentage', '==', '1' ), |
| 40 |
), |
| 41 |
|
| 42 |
array( |
| 43 |
'id' => 'label_position', |
| 44 |
'type' => 'select', |
| 45 |
'title' => esc_html__( 'Position', 'merchant' ), |
| 46 |
'options' => array( |
| 47 |
'top-left' => esc_html__( 'Top left', 'merchant' ), |
| 48 |
'top-right' => esc_html__( 'Top right', 'merchant' ), |
| 49 |
), |
| 50 |
'default' => 'left', |
| 51 |
), |
| 52 |
|
| 53 |
array( |
| 54 |
'id' => 'label_shape', |
| 55 |
'type' => 'range', |
| 56 |
'title' => esc_html__( 'Shape radius', 'merchant' ), |
| 57 |
'min' => 0, |
| 58 |
'max' => 35, |
| 59 |
'step' => 1, |
| 60 |
'unit' => 'px', |
| 61 |
'default' => 0 |
| 62 |
), |
| 63 |
|
| 64 |
array( |
| 65 |
'id' => 'label_text_transform', |
| 66 |
'type' => 'select', |
| 67 |
'title' => esc_html__( 'Letter case', 'merchant' ), |
| 68 |
'options' => array( |
| 69 |
'uppercase' => esc_html__( 'Uppercase', 'merchant' ), |
| 70 |
'lowercase' => esc_html__( 'Lowercase', 'merchant' ), |
| 71 |
'capitalize' => esc_html__( 'Capitalize', 'merchant' ), |
| 72 |
'none' => esc_html__( 'None', 'merchant' ), |
| 73 |
), |
| 74 |
'default' => 'uppercase' |
| 75 |
), |
| 76 |
|
| 77 |
array( |
| 78 |
'id' => 'padding', |
| 79 |
'type' => 'range', |
| 80 |
'title' => esc_html__( 'Padding', 'merchant' ), |
| 81 |
'min' => 0, |
| 82 |
'max' => 250, |
| 83 |
'step' => 1, |
| 84 |
'unit' => 'px', |
| 85 |
'default' => 8, |
| 86 |
), |
| 87 |
|
| 88 |
array( |
| 89 |
'id' => 'font-size', |
| 90 |
'type' => 'range', |
| 91 |
'title' => esc_html__( 'Font size', 'merchant' ), |
| 92 |
'min' => 0, |
| 93 |
'max' => 250, |
| 94 |
'step' => 1, |
| 95 |
'unit' => 'px', |
| 96 |
'default' => 14, |
| 97 |
), |
| 98 |
|
| 99 |
array( |
| 100 |
'id' => 'background_color', |
| 101 |
'type' => 'color', |
| 102 |
'title' => esc_html__( 'Background color', 'merchant' ), |
| 103 |
'default' => '#212121', |
| 104 |
), |
| 105 |
|
| 106 |
array( |
| 107 |
'id' => 'text_color', |
| 108 |
'type' => 'color', |
| 109 |
'title' => esc_html__( 'Text color', 'merchant' ), |
| 110 |
'default' => '#ffffff', |
| 111 |
), |
| 112 |
|
| 113 |
), |
| 114 |
) ); |
| 115 |
|