Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Add JKIT Widgets to WPML Translate (Icon Box and Accordion widgets) */
- function add_jkit_widgets_to_translate( $widgets ) {
- $widgets['jkit_icon_box'] = array(
- 'conditions' => array( 'widgetType' => 'jkit_icon_box' ),
- 'fields' => array(
- array(
- 'field' => 'sg_icon_text',
- 'type' => __( 'JKIT Icon Box: Icon Box: Title', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_icon_description',
- 'type' => __( 'JKIT Icon Box: Icon Box: Description', 'jeg-elementor-kit' ),
- 'editor_type' => 'AREA',
- ),
- array(
- 'field' => 'sg_readmore_button_label',
- 'type' => __( 'JKIT Icon Box: Read More: Button Label', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_badge_text',
- 'type' => __( 'JKIT Icon Box: Badge: Text', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- ),
- );
- $widgets['jkit_accordion'] = array(
- 'conditions' => array( 'widgetType' => 'jkit_accordion' ),
- 'fields' => array(),
- 'integration-class' => 'WPML_JKIT_Accordion_Custom',
- );
- return $widgets;
- }
- add_filter( 'wpml_elementor_widgets_to_translate', 'add_jkit_widgets_to_translate' );
- /** Add custom class for JKIT Accordion widget translation*/
- add_action(
- 'init',
- function() {
- /** Class JKIT Accordion Translation */
- class WPML_JKIT_Accordion_Custom extends WPML_Elementor_Module_With_Items {
- /**
- * @return string
- */
- public function get_items_field() {
- return 'sg_accordion_list';
- }
- /**
- * @return array
- */
- public function get_fields() {
- return array( 'sg_accordion_list_title', 'sg_accordion_list_content' );
- }
- /**
- * @param string $field
- *
- * @return string
- */
- protected function get_title( $field ) {
- switch ( $field ) {
- case 'sg_accordion_list_title':
- return esc_html__( 'JKIT Accordion: Accordion: Title', 'jeg-elementor-kit' );
- case 'sg_accordion_list_content':
- return esc_html__( 'JKIT Accordion: Accordion: Content Description', 'jeg-elementor-kit' );
- default:
- return '';
- }
- }
- /**
- * @param string $field
- *
- * @return string
- */
- protected function get_editor_type( $field ) {
- switch ( $field ) {
- case 'sg_accordion_list_title':
- return 'LINE';
- case 'sg_accordion_list_content':
- return 'VISUAL';
- default:
- return '';
- }
- }
- }
- }
- );
Add Comment
Please, Sign In to add comment