| 1 |
<?php |
| 2 |
|
| 3 |
namespace Sellkit\Compatibility\Wpml; |
| 4 |
|
| 5 |
defined( 'ABSPATH' ) || die(); |
| 6 |
|
| 7 |
/** |
| 8 |
* Sellkit WPML compatibility module with WPML. |
| 9 |
* |
| 10 |
* @since 2.3.2 |
| 11 |
*/ |
| 12 |
class Module { |
| 13 |
|
| 14 |
/** |
| 15 |
* Constructor. |
| 16 |
* |
| 17 |
* @since 2.3.2 |
| 18 |
*/ |
| 19 |
public function __construct() { |
| 20 |
add_filter( 'wpml_elementor_widgets_to_translate', [ $this, 'register_widgets_fields' ] ); |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Load external classes for repeater fields. |
| 25 |
* |
| 26 |
* @since 2.3.2 |
| 27 |
*/ |
| 28 |
public function load_integration_files() { |
| 29 |
sellkit()->load_files( [ |
| 30 |
'compatibility/wpml/modules/checkout-shipping', |
| 31 |
'compatibility/wpml/modules/checkout-billing', |
| 32 |
'compatibility/wpml/modules/optin', |
| 33 |
'compatibility/wpml/modules/order-details', |
| 34 |
] ); |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Register widgets fields for translation. |
| 39 |
* |
| 40 |
* @since 2.3.2 |
| 41 |
* |
| 42 |
* @param array $fields Fields to translate. |
| 43 |
* |
| 44 |
* @return array |
| 45 |
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) |
| 46 |
*/ |
| 47 |
public function register_widgets_fields( $fields ) { |
| 48 |
$this->load_integration_files(); |
| 49 |
|
| 50 |
// Accept Reject Button. |
| 51 |
$fields['sellkit-accept-reject-button'] = [ |
| 52 |
'conditions' => [ 'widgetType' => 'sellkit-accept-reject-button' ], |
| 53 |
'fields' => [ |
| 54 |
[ |
| 55 |
'field' => 'title', |
| 56 |
'type' => esc_html__( 'Sellkit Accept Reject Button: Title', 'sellkit' ), |
| 57 |
'editor_type' => 'LINE', |
| 58 |
], |
| 59 |
[ |
| 60 |
'field' => 'sub_title', |
| 61 |
'type' => esc_html__( 'Sellkit Accept Reject Button: Sub Title', 'sellkit' ), |
| 62 |
'editor_type' => 'LINE', |
| 63 |
], |
| 64 |
], |
| 65 |
]; |
| 66 |
|
| 67 |
// Checkout. |
| 68 |
$fields['sellkit-checkout'] = [ |
| 69 |
'conditions' => [ 'widgetType' => 'sellkit-checkout' ], |
| 70 |
'fields' => [ |
| 71 |
[ |
| 72 |
'field' => 'place_order_btn_txt', |
| 73 |
'type' => esc_html__( 'Sellkit Checkout: Place Order Button Text', 'sellkit' ), |
| 74 |
'editor_type' => 'LINE', |
| 75 |
], |
| 76 |
[ |
| 77 |
'field' => 'empty_cart', |
| 78 |
'type' => esc_html__( 'Sellkit Checkout: Empty cart Text', 'sellkit' ), |
| 79 |
'editor_type' => 'LINE', |
| 80 |
], |
| 81 |
[ |
| 82 |
'field' => 'secure_transaction_text', |
| 83 |
'type' => esc_html__( 'Sellkit Checkout: Payment Description', 'sellkit' ), |
| 84 |
'editor_type' => 'LINE', |
| 85 |
], |
| 86 |
[ |
| 87 |
'field' => 'select_address_text', |
| 88 |
'type' => esc_html__( 'Sellkit Checkout: Billing Details Description', 'sellkit' ), |
| 89 |
'editor_type' => 'LINE', |
| 90 |
], |
| 91 |
], |
| 92 |
'integration-class' => [ |
| 93 |
__NAMESPACE__ . '\Modules\Checkout_Shipping', |
| 94 |
__NAMESPACE__ . '\Modules\Checkout_Billing', |
| 95 |
] |
| 96 |
]; |
| 97 |
|
| 98 |
// Optin. |
| 99 |
$fields['sellkit-optin'] = [ |
| 100 |
'conditions' => [ 'widgetType' => 'sellkit-optin' ], |
| 101 |
'fields' => [ |
| 102 |
[ |
| 103 |
'field' => 'submit_button_text', |
| 104 |
'type' => esc_html__( 'Sellkit Optin: Submit Button Text', 'sellkit' ), |
| 105 |
'editor_type' => 'LINE', |
| 106 |
], |
| 107 |
[ |
| 108 |
'field' => 'submit_button_subtext', |
| 109 |
'type' => esc_html__( 'Sellkit Optin: Submit Button Sub Text', 'sellkit' ), |
| 110 |
'editor_type' => 'LINE', |
| 111 |
], |
| 112 |
'download_url' => [ |
| 113 |
'field' => 'url', |
| 114 |
'type' => esc_html__( 'Sellkit Optin: Download URL', 'sellkit' ), |
| 115 |
'editor_type' => 'LINK', |
| 116 |
], |
| 117 |
'redirect_url' => [ |
| 118 |
'field' => 'url', |
| 119 |
'type' => esc_html__( 'Sellkit Optin: Redirect URL', 'sellkit' ), |
| 120 |
'editor_type' => 'LINK', |
| 121 |
], |
| 122 |
[ |
| 123 |
'field' => 'messages_success', |
| 124 |
'type' => esc_html__( 'Sellkit Optin: Success Message', 'sellkit' ), |
| 125 |
'editor_type' => 'LINE', |
| 126 |
], |
| 127 |
[ |
| 128 |
'field' => 'messages_error', |
| 129 |
'type' => esc_html__( 'Sellkit Optin: Error Message', 'sellkit' ), |
| 130 |
'editor_type' => 'LINE', |
| 131 |
], |
| 132 |
[ |
| 133 |
'field' => 'messages_required', |
| 134 |
'type' => esc_html__( 'Sellkit Optin: Required Message', 'sellkit' ), |
| 135 |
'editor_type' => 'LINE', |
| 136 |
], |
| 137 |
], |
| 138 |
'integration-class' => [ |
| 139 |
__NAMESPACE__ . '\Modules\Optin', |
| 140 |
] |
| 141 |
]; |
| 142 |
|
| 143 |
// Order Cart Details. |
| 144 |
$fields['sellkit-order-cart-details'] = [ |
| 145 |
'conditions' => [ 'widgetType' => 'sellkit-order-cart-details' ], |
| 146 |
'fields' => [ |
| 147 |
[ |
| 148 |
'field' => 'label', |
| 149 |
'type' => esc_html__( 'Sellkit Order Cart Details: Label', 'sellkit' ), |
| 150 |
'editor_type' => 'LINE', |
| 151 |
], |
| 152 |
], |
| 153 |
]; |
| 154 |
|
| 155 |
// Order Details. |
| 156 |
$fields['sellkit-order-details'] = [ |
| 157 |
'conditions' => [ 'widgetType' => 'sellkit-order-details' ], |
| 158 |
'fields' => [ |
| 159 |
[ |
| 160 |
'field' => 'list_name', |
| 161 |
'type' => esc_html__( 'Sellkit Order Details: Heading', 'sellkit' ), |
| 162 |
'editor_type' => 'LINE', |
| 163 |
], |
| 164 |
], |
| 165 |
'integration-class' => [ |
| 166 |
__NAMESPACE__ . '\Modules\Order_Details', |
| 167 |
] |
| 168 |
]; |
| 169 |
|
| 170 |
return $fields; |
| 171 |
} |
| 172 |
} |
| 173 |
|