translate.php
200 lines
| 1 | <?php |
| 2 | // Include integration classes for repetition values |
| 3 | include_once( 'integration-classes/flexible-list.php' ); |
| 4 | include_once( 'integration-classes/accordion-items.php' ); |
| 5 | include_once( 'integration-classes/tabs.php' ); |
| 6 | |
| 7 | /** |
| 8 | * Make our widgets compatible with WPML elementor list |
| 9 | * |
| 10 | * @param array $widgets |
| 11 | * @return array |
| 12 | */ |
| 13 | function auxin_wpml_widgets_to_translate_list( $widgets ) { |
| 14 | |
| 15 | $widgets[ 'aux_modern_heading' ] = array( |
| 16 | 'conditions' => array( 'widgetType' => 'aux_modern_heading' ), |
| 17 | 'fields' => array( |
| 18 | array( |
| 19 | 'field' => 'title', |
| 20 | 'type' => __( 'Modern Heading: Title', 'auxin-elements' ), |
| 21 | 'editor_type' => 'LINE' |
| 22 | ), |
| 23 | array( |
| 24 | 'field' => 'description', |
| 25 | 'type' => __( 'Modern Heading: Description', 'auxin-elements' ), |
| 26 | 'editor_type' => 'VISUAL' |
| 27 | ), |
| 28 | array( |
| 29 | 'field' => 'title_secondary_before', |
| 30 | 'type' => __( 'Modern Heading: Before Text', 'auxin-elements' ), |
| 31 | 'editor_type' => 'LINE' |
| 32 | ), |
| 33 | array( |
| 34 | 'field' => 'title_secondary_highlight', |
| 35 | 'type' => __( 'Modern Heading: Highlighted Text', 'auxin-elements' ), |
| 36 | 'editor_type' => 'LINE' |
| 37 | ), |
| 38 | array( |
| 39 | 'field' => 'title_secondary_after', |
| 40 | 'type' => __( 'Modern Heading: After Text', 'auxin-elements' ), |
| 41 | 'editor_type' => 'LINE' |
| 42 | ) |
| 43 | ), |
| 44 | ); |
| 45 | |
| 46 | $widgets[ 'aux_icon_list' ] = array( |
| 47 | 'conditions' => array( 'widgetType' => 'aux_icon_list' ), |
| 48 | 'fields' => array(), |
| 49 | 'integration-class' => 'Auxin_WPML_Elementor_Icon_List', |
| 50 | ); |
| 51 | |
| 52 | $widgets[ 'aux_accordion' ] = array( |
| 53 | 'conditions' => array( 'widgetType' => 'aux_accordion' ), |
| 54 | 'fields' => array(), |
| 55 | 'integration-class' => 'Auxin_WPML_Elementor_Accordion', |
| 56 | ); |
| 57 | |
| 58 | $widgets[ 'aux_tabs' ] = array( |
| 59 | 'conditions' => array( 'widgetType' => 'aux_tabs' ), |
| 60 | 'fields' => array(), |
| 61 | 'integration-class' => 'Auxin_WPML_Elementor_Tabs', |
| 62 | ); |
| 63 | |
| 64 | $widgets[ 'aux_button' ] = array( |
| 65 | 'conditions' => array( 'widgetType' => 'aux_button' ), |
| 66 | 'fields' => array( |
| 67 | array( |
| 68 | 'field' => 'label', |
| 69 | 'type' => __( 'Button: Label', 'auxin-elements' ), |
| 70 | 'editor_type' => 'LINE' |
| 71 | ), |
| 72 | ), |
| 73 | ); |
| 74 | |
| 75 | $widgets[ 'aux_contact_form' ] = array( |
| 76 | 'conditions' => array( 'widgetType' => 'aux_contact_form' ), |
| 77 | 'fields' => array( |
| 78 | array( |
| 79 | 'field' => 'label', |
| 80 | 'type' => __( 'Contact Form 7: Shortcode', 'auxin-elements' ), |
| 81 | 'editor_type' => 'LINE' |
| 82 | ), |
| 83 | ), |
| 84 | ); |
| 85 | |
| 86 | $widgets[ 'aux_blockquote' ] = array( |
| 87 | 'conditions' => array( 'widgetType' => 'aux_blockquote' ), |
| 88 | 'fields' => array( |
| 89 | array( |
| 90 | 'field' => 'content', |
| 91 | 'type' => __( 'Blockquote: Content', 'auxin-elements' ), |
| 92 | 'editor_type' => 'VISUAL' |
| 93 | ), |
| 94 | ), |
| 95 | ); |
| 96 | |
| 97 | $widgets[ 'aux_staff' ] = array( |
| 98 | 'conditions' => array( 'widgetType' => 'aux_staff' ), |
| 99 | 'fields' => array( |
| 100 | array( |
| 101 | 'field' => 'title', |
| 102 | 'type' => __( 'Staff: Name', 'auxin-elements' ), |
| 103 | 'editor_type' => 'LINE' |
| 104 | ), |
| 105 | array( |
| 106 | 'field' => 'subtitle', |
| 107 | 'type' => __( 'Staff: Occupation', 'auxin-elements' ), |
| 108 | 'editor_type' => 'LINE' |
| 109 | ), |
| 110 | array( |
| 111 | 'field' => 'content', |
| 112 | 'type' => __( 'Staff: Content', 'auxin-elements' ), |
| 113 | 'editor_type' => 'VISUAL' |
| 114 | ) |
| 115 | ), |
| 116 | ); |
| 117 | |
| 118 | $widgets[ 'aux_testimonial' ] = array( |
| 119 | 'conditions' => array( 'widgetType' => 'aux_testimonial' ), |
| 120 | 'fields' => array( |
| 121 | array( |
| 122 | 'field' => 'title', |
| 123 | 'type' => __( 'Testimonial: Name', 'auxin-elements' ), |
| 124 | 'editor_type' => 'LINE' |
| 125 | ), |
| 126 | array( |
| 127 | 'field' => 'subtitle', |
| 128 | 'type' => __( 'Testimonial: Occupation', 'auxin-elements' ), |
| 129 | 'editor_type' => 'LINE' |
| 130 | ), |
| 131 | array( |
| 132 | 'field' => 'content', |
| 133 | 'type' => __( 'Testimonial: Content', 'auxin-elements' ), |
| 134 | 'editor_type' => 'VISUAL' |
| 135 | ) |
| 136 | ), |
| 137 | ); |
| 138 | |
| 139 | $widgets[ 'aux_text' ] = array( |
| 140 | 'conditions' => array( 'widgetType' => 'aux_text' ), |
| 141 | 'fields' => array( |
| 142 | array( |
| 143 | 'field' => 'title', |
| 144 | 'type' => __( 'Info Box: Name', 'auxin-elements' ), |
| 145 | 'editor_type' => 'LINE' |
| 146 | ), |
| 147 | array( |
| 148 | 'field' => 'subtitle', |
| 149 | 'type' => __( 'Info Box: Occupation', 'auxin-elements' ), |
| 150 | 'editor_type' => 'LINE' |
| 151 | ), |
| 152 | array( |
| 153 | 'field' => 'content', |
| 154 | 'type' => __( 'Info Box: Content', 'auxin-elements' ), |
| 155 | 'editor_type' => 'VISUAL' |
| 156 | ), |
| 157 | array( |
| 158 | 'field' => 'btn_label', |
| 159 | 'type' => __( 'Info Box: Button label', 'auxin-elements' ), |
| 160 | 'editor_type' => 'LINE' |
| 161 | ) |
| 162 | ), |
| 163 | ); |
| 164 | |
| 165 | $widgets[ 'aux_gmap' ] = array( |
| 166 | 'conditions' => array( 'widgetType' => 'aux_gmap' ), |
| 167 | 'fields' => array( |
| 168 | array( |
| 169 | 'field' => 'latitude', |
| 170 | 'type' => __( 'MAP: Latitude', 'auxin-elements' ), |
| 171 | 'editor_type' => 'LINE' |
| 172 | ), |
| 173 | array( |
| 174 | 'field' => 'longitude', |
| 175 | 'type' => __( 'MAP: Longitude', 'auxin-elements' ), |
| 176 | 'editor_type' => 'LINE' |
| 177 | ), |
| 178 | array( |
| 179 | 'field' => 'marker_info', |
| 180 | 'type' => __( 'MAP: Marker info', 'auxin-elements' ), |
| 181 | 'editor_type' => 'LINE' |
| 182 | ) |
| 183 | ), |
| 184 | ); |
| 185 | |
| 186 | |
| 187 | return $widgets; |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * Add filter on wpml elementor widgets node when init action. |
| 192 | * |
| 193 | * @return void |
| 194 | */ |
| 195 | function auxin_wpml_widgets_to_translate_filter(){ |
| 196 | add_filter( 'wpml_elementor_widgets_to_translate', 'auxin_wpml_widgets_to_translate_list' ); |
| 197 | } |
| 198 | add_action( 'init', 'auxin_wpml_widgets_to_translate_filter' ); |
| 199 | |
| 200 |