| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Product Brand Image Options. |
| 5 |
* |
| 6 |
* @package Merchant |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly |
| 11 |
} |
| 12 |
|
| 13 |
// Settings |
| 14 |
Merchant_Admin_Options::create( array( |
| 15 |
'title' => esc_html__( 'Settings', 'merchant' ), |
| 16 |
'module' => Merchant_Product_Brand_Image::MODULE_ID, |
| 17 |
'fields' => array( |
| 18 |
|
| 19 |
array( |
| 20 |
'id' => 'global-brand-image', |
| 21 |
'type' => 'upload', |
| 22 |
'title' => esc_html__( 'Upload brand image', 'merchant' ), |
| 23 |
/* Translators: 1. Link open tag 2. Link close tag */ |
| 24 |
'desc' => sprintf( esc_html__( 'Note: If you want to add a different brand image for each product, go to %1$sProducts%2$s, edit the desired product and upload a different image.', 'merchant' ), '<a href="'. esc_url( admin_url( 'edit.php?post_type=product' ) ).'">', '</a>' ), |
| 25 |
), |
| 26 |
|
| 27 |
array( |
| 28 |
'type' => 'divider', |
| 29 |
), |
| 30 |
|
| 31 |
array( |
| 32 |
'id' => 'margin-top', |
| 33 |
'type' => 'range', |
| 34 |
'title' => esc_html__( 'Margin top', 'merchant' ), |
| 35 |
'min' => 0, |
| 36 |
'max' => 250, |
| 37 |
'step' => 1, |
| 38 |
'default' => 15, |
| 39 |
'unit' => 'px', |
| 40 |
), |
| 41 |
|
| 42 |
array( |
| 43 |
'id' => 'margin-bottom', |
| 44 |
'type' => 'range', |
| 45 |
'title' => esc_html__( 'Margin bottom', 'merchant' ), |
| 46 |
'min' => 0, |
| 47 |
'max' => 250, |
| 48 |
'step' => 1, |
| 49 |
'default' => 15, |
| 50 |
'unit' => 'px', |
| 51 |
), |
| 52 |
|
| 53 |
array( |
| 54 |
'id' => 'image-max-width', |
| 55 |
'type' => 'range', |
| 56 |
'title' => esc_html__( 'Image max width', 'merchant' ), |
| 57 |
'min' => 1, |
| 58 |
'max' => 500, |
| 59 |
'step' => 1, |
| 60 |
'default' => 250, |
| 61 |
'unit' => 'px', |
| 62 |
), |
| 63 |
|
| 64 |
array( |
| 65 |
'id' => 'image-max-height', |
| 66 |
'type' => 'range', |
| 67 |
'title' => esc_html__( 'Image max height', 'merchant' ), |
| 68 |
'min' => 1, |
| 69 |
'max' => 500, |
| 70 |
'step' => 1, |
| 71 |
'default' => 250, |
| 72 |
'unit' => 'px', |
| 73 |
), |
| 74 |
|
| 75 |
) |
| 76 |
) ); |
| 77 |
|
| 78 |
// Shortcode |
| 79 |
$merchant_module_id = Merchant_Product_Brand_Image::MODULE_ID; |
| 80 |
Merchant_Admin_Options::create( array( |
| 81 |
'module' => $merchant_module_id, |
| 82 |
'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 83 |
'fields' => array( |
| 84 |
array( |
| 85 |
'id' => 'use_shortcode', |
| 86 |
'type' => 'switcher', |
| 87 |
'title' => __( 'Use shortcode', 'merchant' ), |
| 88 |
'default' => 0, |
| 89 |
'desc' => esc_html__( 'If you are using a page builder or a theme that supports shortcodes, then you can output the module using the shortcode above. This might be useful if, for example, you find that you want to control the position of the module output more precisely than with the module settings. Note that the shortcodes can only be used on single product pages.', |
| 90 |
'merchant' ), |
| 91 |
), |
| 92 |
array( |
| 93 |
'id' => 'shortcode_text', |
| 94 |
'type' => 'text_readonly', |
| 95 |
'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 96 |
'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']', |
| 97 |
'condition' => array( 'use_shortcode', '==', '1' ), |
| 98 |
), |
| 99 |
), |
| 100 |
) ); |