Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Add JKIT Widgets to WPML Translate */
- function add_jkit_widgets_to_translate( $widgets ) {
- /** JKIT - Icon Box */
- $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',
- ),
- ),
- );
- /** JKIT - Accordion Widget */
- $widgets['jkit_accordion'] = array(
- 'conditions' => array( 'widgetType' => 'jkit_accordion' ),
- 'fields' => array(),
- 'integration-class' => 'WPML_JKIT_Accordion_Custom',
- );
- /** JKIT - Testimonials Widget */
- $widgets['jkit_testimonials'] = array(
- 'conditions' => array( 'widgetType' => 'jkit_testimonials' ),
- 'fields' => array(),
- 'integration-class' => 'WPML_JKIT_Testimonials_Custom',
- );
- /** JKIT - Heading Widget */
- $widgets['jkit_heading'] = array(
- 'conditions' => array( 'widgetType' => 'jkit_heading' ),
- 'fields' => array(
- array(
- 'field' => 'sg_title_before',
- 'type' => __( 'JKIT Heading: Title: Before Focused Title', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_title_focused',
- 'type' => __( 'JKIT Heading: Title: Focused Title', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_title_after',
- 'type' => __( 'JKIT Heading: Title: After Focused Title', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_subtitle_heading',
- 'type' => __( 'JKIT Heading: Subtitle: Heading Sub Title', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_description',
- 'type' => __( 'JKIT Heading: Description: Heading Description', 'jeg-elementor-kit' ),
- 'editor_type' => 'VISUAL',
- ),
- array(
- 'field' => 'sg_shadow_content',
- 'type' => __( 'JKIT Heading: Shadow Text: Content', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- ),
- );
- /** JKIT - Image Box Widget */
- $widgets['jkit_image_box'] = array(
- 'conditions' => array( 'widgetType' => 'jkit_image_box' ),
- 'fields' => array(
- array(
- 'field' => 'sg_image_link',
- 'type' => __( 'JKIT Image Box: Image: Link', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_body_title',
- 'type' => __( 'JKIT Image Box: Body: Title', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_body_description',
- 'type' => __( 'JKIT Image Box: Body: Description', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_button_label',
- 'type' => __( 'JKIT Image Box: Button: Label', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_button_link',
- 'type' => __( 'JKIT Image Box: Button: Link', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- ),
- );
- /** JKIT - Button Widget */
- $widgets['jkit_button'] = array(
- 'conditions' => array( 'widgetType' => 'jkit_button' ),
- 'fields' => array(
- array(
- 'field' => 'sg_content_label',
- 'type' => __( 'JKIT Button: Content: Label', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_content_link',
- 'type' => __( 'JKIT Button: Content: Link', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_content_class',
- 'type' => __( 'JKIT Button: Content: Class', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_button_label',
- 'type' => __( 'JKIT Image Box: Button: Label', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_content_id',
- 'type' => __( 'JKIT Image Box: Button: ID', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- ),
- );
- /** JKIT - Animated Text */
- $widgets['jkit_animated_text'] = array(
- 'conditions' => array( 'widgetType' => 'jkit_animated_text' ),
- 'fields' => array(
- array(
- 'field' => 'sg_text_before',
- 'type' => __( 'JKIT Animated Text: Text: Before Text', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_text_animated',
- 'type' => __( 'JKIT Animated Text: Text: Animated Text', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_text_after',
- 'type' => __( 'JKIT Animated Text: Text: Rotating Text', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- ),
- 'integration-class' => 'WPML_JKIT_Animated_Text_Custom',
- );
- /** JKIT - Pie Chart */
- $widgets['jkit_pie_chart'] = array(
- 'conditions' => array( 'widgetType' => 'jkit_pie_chart' ),
- 'fields' => array(
- array(
- 'field' => 'sg_content_title',
- 'type' => __( 'JKIT Pie Chart: Content: Title', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_content_description',
- 'type' => __( 'JKIT Pie Chart: Content: Description', 'jeg-elementor-kit' ),
- 'editor_type' => 'AREA',
- ),
- ),
- );
- /** JKIT - Fun Fact */
- $widgets['jkit_fun_fact'] = array(
- 'conditions' => array( 'widgetType' => 'jkit_fun_fact' ),
- 'fields' => array(
- array(
- 'field' => 'sg_content_number_prefix',
- 'type' => __( 'JKIT Fun Fact: Content: Number Prefix', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_content_number',
- 'type' => __( 'JKIT Fun Fact: Content: Number', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_content_number_suffix',
- 'type' => __( 'JKIT Fun Fact: Content: Number Suffix', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_content_title',
- 'type' => __( 'JKIT Fun Fact: Content: Title', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- array(
- 'field' => 'sg_content_super',
- 'type' => __( 'JKIT Fun Fact: Content: Super', 'jeg-elementor-kit' ),
- 'editor_type' => 'LINE',
- ),
- ),
- );
- return $widgets;
- }
- add_filter( 'wpml_elementor_widgets_to_translate', 'add_jkit_widgets_to_translate' );
- /** Add a custom class for widget translation who have a Repeater Control */
- 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 '';
- }
- }
- }
- /** class JKIT Testimonials Translation */
- class WPML_JKIT_Testimonials_Custom extends WPML_Elementor_Module_With_Items {
- /**
- * @return string
- */
- public function get_items_field() {
- return 'sg_testimonials_list';
- }
- /**
- * @return array
- */
- public function get_fields() {
- return array( 'sg_testimonials_list_client_name', 'sg_testimonials_list_designation', 'sg_testimonials_list_review' );
- }
- /**
- * @param string $field
- *
- * @return string
- */
- protected function get_title( $field ) {
- switch ( $field ) {
- case 'sg_testimonials_list_client_name':
- return esc_html__( 'JKIT Testimonials: Testimonials: Client Name', 'jeg-elementor-kit' );
- case 'sg_testimonials_list_designation':
- return esc_html__( 'JKIT Testimonials: Testimonials: Designation', 'jeg-elementor-kit' );
- case 'sg_testimonials_list_review':
- return esc_html__( 'JKIT Testimonials: Testimonials: Review', 'jeg-elementor-kit' );
- default:
- return '';
- }
- }
- /**
- * @param string $field
- *
- * @return string
- */
- protected function get_editor_type( $field ) {
- switch ( $field ) {
- case 'sg_testimonials_list_client_name':
- return 'LINE';
- case 'sg_testimonials_list_designation':
- return 'LINE';
- case 'sg_testimonials_list_review':
- return 'LINE';
- default:
- return '';
- }
- }
- }
- /** class JKIT Animated Text Translation */
- class WPML_JKIT_Animated_Text_Custom extends WPML_Elementor_Module_With_Items {
- /**
- * @return string
- */
- public function get_items_field() {
- return 'sg_text_rotating_list';
- }
- /**
- * @return array
- */
- public function get_fields() {
- return array( 'sg_text_rotating_list_text' );
- }
- /**
- * @param string $field
- *
- * @return string
- */
- protected function get_title( $field ) {
- switch ( $field ) {
- case 'sg_text_rotating_list_text':
- return esc_html__( 'JKIT Testimonials: Text: Rotating Text', 'jeg-elementor-kit' );
- default:
- return '';
- }
- }
- /**
- * @param string $field
- *
- * @return string
- */
- protected function get_editor_type( $field ) {
- switch ( $field ) {
- case 'sg_text_rotating_list_text':
- return 'LINE';
- default:
- return '';
- }
- }
- }
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement