| 1 |
<?php |
| 2 |
|
| 3 |
namespace Sellkit\Compatibility\Wpml\Modules; |
| 4 |
|
| 5 |
defined( 'ABSPATH' ) || die(); |
| 6 |
|
| 7 |
/** |
| 8 |
* Class Order_Details |
| 9 |
* |
| 10 |
* This class handles the compatibility of the fields in Sellkit |
| 11 |
* with WPML for translation within Elementor modules. |
| 12 |
* |
| 13 |
* @since 2.3.2 |
| 14 |
*/ |
| 15 |
class Order_Details extends \WPML_Elementor_Module_With_Items { |
| 16 |
/** |
| 17 |
* Retrieves the field name that holds the items. |
| 18 |
* |
| 19 |
* @since 2.3.2 |
| 20 |
* |
| 21 |
* @return string The name of the field that contains the items. |
| 22 |
*/ |
| 23 |
public function get_items_field() { |
| 24 |
return 'fields'; |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Retrieves the fields that are translatable. |
| 29 |
* |
| 30 |
* @since 2.3.2 |
| 31 |
* |
| 32 |
* @return array List of fields that support translations. |
| 33 |
*/ |
| 34 |
public function get_fields() { |
| 35 |
return [ |
| 36 |
'label', |
| 37 |
]; |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Retrieves the translation title for each field. |
| 42 |
* |
| 43 |
* @since 2.3.2 |
| 44 |
* |
| 45 |
* @param string $field The field name. |
| 46 |
* |
| 47 |
* @return string The title for the translation of the field. |
| 48 |
*/ |
| 49 |
protected function get_title( $field ) { |
| 50 |
switch ( $field ) { |
| 51 |
case 'label': |
| 52 |
return esc_html__( 'Sellkit Order Details: Items Label', 'sellkit' ); |
| 53 |
|
| 54 |
default: |
| 55 |
return ''; |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Retrieves the editor type for each field. |
| 61 |
* |
| 62 |
* @since 2.3.2 |
| 63 |
* |
| 64 |
* @param string $field The field name. |
| 65 |
* |
| 66 |
* @return string The editor type for the translation. |
| 67 |
*/ |
| 68 |
protected function get_editor_type( $field ) { |
| 69 |
switch ( $field ) { |
| 70 |
case 'label': |
| 71 |
return 'LINE'; |
| 72 |
|
| 73 |
default: |
| 74 |
return ''; |
| 75 |
} |
| 76 |
} |
| 77 |
} |
| 78 |
|