Polylang Connect for Elementor – Templates Translation & Language Switcher - Version 2.0.4

Version Description

  • Added better info of template instances for translations on Theme Editor and WP admin list.
  • Minor tweaks on Language Switcher dropdown styles.
Download this release

Release Info

Developer pacotole
Plugin Icon 128x128 Polylang Connect for Elementor – Templates Translation & Language Switcher
Version 2.0.4
Comparing to
See all releases

Code changes from version 2.0.3 to 2.0.4

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: elementor, polylang, multilingual, language switcher, languages, templates
5
  Requires at least: 5.4
6
  Tested up to: 5.9
7
  Requires PHP: 5.6
8
- Stable tag: 2.0.3
9
  License: GPL-2.0-or-later
10
  License URI: https://opensource.org/licenses/GPL-2.0
11
 
@@ -194,6 +194,10 @@ There are quite a few:
194
 
195
  == Changelog ==
196
 
 
 
 
 
197
  = 2.0.3 =
198
  * Updated language switcher dropdown animated & toogle on mobile.
199
  * Added Elementor icon in posts list status.
@@ -282,7 +286,7 @@ Fixed critical error loading plugin classes when there are uppercase letters in
282
 
283
  == Upgrade Notice ==
284
 
285
- = 2.0.3 =
286
  **Warning** breaking changes with v1. Language Switcher and Dynamic Tags has been renamed and neeed to re-added again in your templates.
287
 
288
  = 1.0.2 =
5
  Requires at least: 5.4
6
  Tested up to: 5.9
7
  Requires PHP: 5.6
8
+ Stable tag: 2.0.4
9
  License: GPL-2.0-or-later
10
  License URI: https://opensource.org/licenses/GPL-2.0
11
 
194
 
195
  == Changelog ==
196
 
197
+ = 2.0.4 =
198
+ * Added better info of template instances for translations on Theme Editor and WP admin list.
199
+ * Minor tweaks on Language Switcher dropdown styles.
200
+
201
  = 2.0.3 =
202
  * Updated language switcher dropdown animated & toogle on mobile.
203
  * Added Elementor icon in posts list status.
286
 
287
  == Upgrade Notice ==
288
 
289
+ = 2.0.4 =
290
  **Warning** breaking changes with v1. Language Switcher and Dynamic Tags has been renamed and neeed to re-added again in your templates.
291
 
292
  = 1.0.2 =
assets/css/language-switcher.css CHANGED
@@ -50,7 +50,7 @@
50
  }
51
 
52
  .cpel-switcher--layout-dropdown .cpel-switcher__toggle a i {
53
- transition: transform 200ms ease-in-out;
54
  }
55
 
56
  .cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on::after {
@@ -59,6 +59,7 @@
59
 
60
  .cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on a i {
61
  transform: rotateX(180deg);
 
62
  }
63
 
64
 
@@ -84,14 +85,16 @@
84
  top: 100%;
85
  display: flex;
86
  flex-direction: column;
 
87
  min-width: 100%;
88
  max-height: 0;
89
  overflow: hidden;
90
- transition: max-height 200ms ease-in-out;
91
  }
92
 
93
  .cpel-switcher--layout-dropdown .cpel-switcher__toggle--on+.cpel-switcher__list {
94
  max-height: 300px;
 
95
  }
96
 
97
  .cpel-switcher--layout-dropdown .cpel-switcher__lang {
50
  }
51
 
52
  .cpel-switcher--layout-dropdown .cpel-switcher__toggle a i {
53
+ transition: transform 0s 200ms;
54
  }
55
 
56
  .cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on::after {
59
 
60
  .cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on a i {
61
  transform: rotateX(180deg);
62
+ transition-delay: 0s;
63
  }
64
 
65
 
85
  top: 100%;
86
  display: flex;
87
  flex-direction: column;
88
+ justify-content: flex-end;
89
  min-width: 100%;
90
  max-height: 0;
91
  overflow: hidden;
92
+ transition: max-height 200ms ease-out;
93
  }
94
 
95
  .cpel-switcher--layout-dropdown .cpel-switcher__toggle--on+.cpel-switcher__list {
96
  max-height: 300px;
97
+ transition: max-height 400ms ease-in;
98
  }
99
 
100
  .cpel-switcher--layout-dropdown .cpel-switcher__lang {
assets/css/language-switcher.min.css CHANGED
@@ -1 +1 @@
1
- .cpel-switcher__nav{--cpel-switcher-space:0;display:block}.cpel-switcher__nav .cpel-switcher__list{display:flex;list-style:none;margin:0;padding:0;line-height:normal;-webkit-tap-highlight-color:rgba(0,0,0,0)}.cpel-switcher__nav a{display:inline-block;text-decoration:none;white-space:nowrap}.cpel-switcher--layout-horizontal .cpel-switcher__list{flex-direction:row;flex-wrap:wrap}.cpel-switcher--layout-vertical .cpel-switcher__list{flex-direction:column}.cpel-switcher--layout-dropdown .cpel-switcher__nav{display:inline-block;position:relative;user-select:none}.cpel-switcher--layout-dropdown .cpel-switcher__toggle{position:relative}.cpel-switcher--layout-dropdown .cpel-switcher__toggle:after{content:"";position:absolute;z-index:2;top:0;right:0;bottom:0;width:100%;cursor:pointer}.cpel-switcher--layout-dropdown .cpel-switcher__toggle a i{transition:transform .2s ease-in-out}.cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on:after{width:min(33%,2.5em)}.cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on a i{transform:rotateX(180deg)}.cpel-switcher--layout-dropdown.cpel-switcher--align-left .elementor-widget-container{text-align:left}.cpel-switcher--layout-dropdown.cpel-switcher--align-center .elementor-widget-container{text-align:center}.cpel-switcher--layout-dropdown.cpel-switcher--align-right .elementor-widget-container{text-align:right}.cpel-switcher--layout-dropdown.cpel-switcher--align-justify .cpel-switcher__nav{display:flex}.cpel-switcher--layout-dropdown .cpel-switcher__list{position:absolute;z-index:10;top:100%;display:flex;flex-direction:column;min-width:100%;max-height:0;overflow:hidden;transition:max-height .2s ease-in-out}.cpel-switcher--layout-dropdown .cpel-switcher__toggle--on+.cpel-switcher__list{max-height:300px}.cpel-switcher--layout-dropdown .cpel-switcher__lang{width:100%}.cpel-switcher--layout-dropdown .cpel-switcher__lang a{display:block;text-align:left}.cpel-switcher--align-left .cpel-switcher__list{align-items:flex-start}.cpel-switcher--align-center .cpel-switcher__list{align-items:center}.cpel-switcher--align-right .cpel-switcher__list{align-items:flex-end}.cpel-switcher--align-justify .cpel-switcher__list{align-items:stretch}.cpel-switcher--align-justify a{width:100%;text-align:center}.cpel-switcher--layout-dropdown.cpel-switcher--align-right .cpel-switcher__list{right:0;left:auto}.cpel-switcher--layout-dropdown.cpel-switcher--align-justify .cpel-switcher__toggle a{display:inline-flex;justify-content:flex-start;align-items:center}.cpel-switcher--layout-dropdown.cpel-switcher--align-justify .cpel-switcher__icon{margin-right:0;margin-left:auto}.cpel-switcher--layout-horizontal.cpel-switcher--align-left .cpel-switcher__list{justify-content:flex-start}.cpel-switcher--layout-horizontal.cpel-switcher--align-center .cpel-switcher__list{justify-content:center}.cpel-switcher--layout-horizontal.cpel-switcher--align-right .cpel-switcher__list{justify-content:flex-end}.cpel-switcher--layout-horizontal.cpel-switcher--align-justify .cpel-switcher__lang{flex-grow:1}.cpel-switcher__lang{margin:0}.cpel-switcher--layout-horizontal .cpel-switcher__lang:not(:last-child){margin-right:var(--cpel-switcher-space)}body.rtl .cpel-switcher--layout-horizontal .cpel-switcher__lang:not(:last-child){margin-left:var(--cpel-switcher-space)}.cpel-switcher--layout-vertical .cpel-switcher__lang:not(:last-child){margin-bottom:var(--cpel-switcher-space)}.cpel-switcher__code,.cpel-switcher__flag,.cpel-switcher__name{display:inline-block;vertical-align:middle}.cpel-switcher__code,.cpel-switcher__name{text-decoration:inherit}.cpel-switcher__flag{line-height:.5em}.cpel-switcher__flag img{width:100%;max-width:100%;height:100%;object-fit:cover;object-position:center}.cpel-switcher__flag--ai img,.cpel-switcher__flag--au img,.cpel-switcher__flag--aw img,.cpel-switcher__flag--bm img,.cpel-switcher__flag--bs img,.cpel-switcher__flag--by img,.cpel-switcher__flag--cd img,.cpel-switcher__flag--ck img,.cpel-switcher__flag--cl img,.cpel-switcher__flag--cn img,.cpel-switcher__flag--cu img,.cpel-switcher__flag--cz img,.cpel-switcher__flag--dj img,.cpel-switcher__flag--er img,.cpel-switcher__flag--es img,.cpel-switcher__flag--esperanto img,.cpel-switcher__flag--fj img,.cpel-switcher__flag--fk img,.cpel-switcher__flag--gq img,.cpel-switcher__flag--gr img,.cpel-switcher__flag--gs img,.cpel-switcher__flag--gw img,.cpel-switcher__flag--gy img,.cpel-switcher__flag--hm img,.cpel-switcher__flag--io img,.cpel-switcher__flag--jo img,.cpel-switcher__flag--km img,.cpel-switcher__flag--kw img,.cpel-switcher__flag--ky img,.cpel-switcher__flag--kz img,.cpel-switcher__flag--lk img,.cpel-switcher__flag--lr img,.cpel-switcher__flag--mg img,.cpel-switcher__flag--mh img,.cpel-switcher__flag--ms img,.cpel-switcher__flag--my img,.cpel-switcher__flag--mz img,.cpel-switcher__flag--na img,.cpel-switcher__flag--np img,.cpel-switcher__flag--nu img,.cpel-switcher__flag--nz img,.cpel-switcher__flag--om img,.cpel-switcher__flag--ph img,.cpel-switcher__flag--pm img,.cpel-switcher__flag--pn img,.cpel-switcher__flag--pr img,.cpel-switcher__flag--ps img,.cpel-switcher__flag--sb img,.cpel-switcher__flag--sc img,.cpel-switcher__flag--sd img,.cpel-switcher__flag--sg img,.cpel-switcher__flag--sh img,.cpel-switcher__flag--sk img,.cpel-switcher__flag--ss img,.cpel-switcher__flag--st img,.cpel-switcher__flag--tc img,.cpel-switcher__flag--tf img,.cpel-switcher__flag--tg img,.cpel-switcher__flag--tk img,.cpel-switcher__flag--tl img,.cpel-switcher__flag--to img,.cpel-switcher__flag--tv img,.cpel-switcher__flag--tw img,.cpel-switcher__flag--us img,.cpel-switcher__flag--uy img,.cpel-switcher__flag--uz img,.cpel-switcher__flag--vg img,.cpel-switcher__flag--vu img,.cpel-switcher__flag--ws img,.cpel-switcher__flag--za img,.cpel-switcher__flag--zw img{object-position:left}.cpel-switcher__flag--eh img,.cpel-switcher__flag--tm img{object-position:20%}.cpel-switcher__flag--ai img,.cpel-switcher__flag--au img,.cpel-switcher__flag--bm img,.cpel-switcher__flag--ck img,.cpel-switcher__flag--fj img,.cpel-switcher__flag--fk img,.cpel-switcher__flag--gs img,.cpel-switcher__flag--hm img,.cpel-switcher__flag--io img,.cpel-switcher__flag--ky img,.cpel-switcher__flag--ms img,.cpel-switcher__flag--nu img,.cpel-switcher__flag--nz img,.cpel-switcher__flag--pn img,.cpel-switcher__flag--sh img,.cpel-switcher__flag--tc img,.cpel-switcher__flag--tf img,.cpel-switcher__flag--tv img,.cpel-switcher__flag--vg img{object-position:75%}.cpel-switcher__flag--as img,.cpel-switcher__flag--zm img{object-position:right}
1
+ .cpel-switcher__nav{--cpel-switcher-space:0;display:block}.cpel-switcher__nav .cpel-switcher__list{display:flex;list-style:none;margin:0;padding:0;line-height:normal;-webkit-tap-highlight-color:rgba(0,0,0,0)}.cpel-switcher__nav a{display:inline-block;text-decoration:none;white-space:nowrap}.cpel-switcher--layout-horizontal .cpel-switcher__list{flex-direction:row;flex-wrap:wrap}.cpel-switcher--layout-vertical .cpel-switcher__list{flex-direction:column}.cpel-switcher--layout-dropdown .cpel-switcher__nav{display:inline-block;position:relative;user-select:none}.cpel-switcher--layout-dropdown .cpel-switcher__toggle{position:relative}.cpel-switcher--layout-dropdown .cpel-switcher__toggle:after{content:"";position:absolute;z-index:2;top:0;right:0;bottom:0;width:100%;cursor:pointer}.cpel-switcher--layout-dropdown .cpel-switcher__toggle a i{transition:transform 0s .2s}.cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on:after{width:min(33%,2.5em)}.cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on a i{transform:rotateX(180deg);transition-delay:0s}.cpel-switcher--layout-dropdown.cpel-switcher--align-left .elementor-widget-container{text-align:left}.cpel-switcher--layout-dropdown.cpel-switcher--align-center .elementor-widget-container{text-align:center}.cpel-switcher--layout-dropdown.cpel-switcher--align-right .elementor-widget-container{text-align:right}.cpel-switcher--layout-dropdown.cpel-switcher--align-justify .cpel-switcher__nav{display:flex}.cpel-switcher--layout-dropdown .cpel-switcher__list{position:absolute;z-index:10;top:100%;display:flex;flex-direction:column;justify-content:flex-end;min-width:100%;max-height:0;overflow:hidden;transition:max-height .2s ease-out}.cpel-switcher--layout-dropdown .cpel-switcher__toggle--on+.cpel-switcher__list{max-height:300px;transition:max-height .4s ease-in}.cpel-switcher--layout-dropdown .cpel-switcher__lang{width:100%}.cpel-switcher--layout-dropdown .cpel-switcher__lang a{display:block;text-align:left}.cpel-switcher--align-left .cpel-switcher__list{align-items:flex-start}.cpel-switcher--align-center .cpel-switcher__list{align-items:center}.cpel-switcher--align-right .cpel-switcher__list{align-items:flex-end}.cpel-switcher--align-justify .cpel-switcher__list{align-items:stretch}.cpel-switcher--align-justify a{width:100%;text-align:center}.cpel-switcher--layout-dropdown.cpel-switcher--align-right .cpel-switcher__list{right:0;left:auto}.cpel-switcher--layout-dropdown.cpel-switcher--align-justify .cpel-switcher__toggle a{display:inline-flex;justify-content:flex-start;align-items:center}.cpel-switcher--layout-dropdown.cpel-switcher--align-justify .cpel-switcher__icon{margin-right:0;margin-left:auto}.cpel-switcher--layout-horizontal.cpel-switcher--align-left .cpel-switcher__list{justify-content:flex-start}.cpel-switcher--layout-horizontal.cpel-switcher--align-center .cpel-switcher__list{justify-content:center}.cpel-switcher--layout-horizontal.cpel-switcher--align-right .cpel-switcher__list{justify-content:flex-end}.cpel-switcher--layout-horizontal.cpel-switcher--align-justify .cpel-switcher__lang{flex-grow:1}.cpel-switcher__lang{margin:0}.cpel-switcher--layout-horizontal .cpel-switcher__lang:not(:last-child){margin-right:var(--cpel-switcher-space)}body.rtl .cpel-switcher--layout-horizontal .cpel-switcher__lang:not(:last-child){margin-left:var(--cpel-switcher-space)}.cpel-switcher--layout-vertical .cpel-switcher__lang:not(:last-child){margin-bottom:var(--cpel-switcher-space)}.cpel-switcher__code,.cpel-switcher__flag,.cpel-switcher__name{display:inline-block;vertical-align:middle}.cpel-switcher__code,.cpel-switcher__name{text-decoration:inherit}.cpel-switcher__flag{line-height:.5em}.cpel-switcher__flag img{width:100%;max-width:100%;height:100%;object-fit:cover;object-position:center}.cpel-switcher__flag--ai img,.cpel-switcher__flag--au img,.cpel-switcher__flag--aw img,.cpel-switcher__flag--bm img,.cpel-switcher__flag--bs img,.cpel-switcher__flag--by img,.cpel-switcher__flag--cd img,.cpel-switcher__flag--ck img,.cpel-switcher__flag--cl img,.cpel-switcher__flag--cn img,.cpel-switcher__flag--cu img,.cpel-switcher__flag--cz img,.cpel-switcher__flag--dj img,.cpel-switcher__flag--er img,.cpel-switcher__flag--es img,.cpel-switcher__flag--esperanto img,.cpel-switcher__flag--fj img,.cpel-switcher__flag--fk img,.cpel-switcher__flag--gq img,.cpel-switcher__flag--gr img,.cpel-switcher__flag--gs img,.cpel-switcher__flag--gw img,.cpel-switcher__flag--gy img,.cpel-switcher__flag--hm img,.cpel-switcher__flag--io img,.cpel-switcher__flag--jo img,.cpel-switcher__flag--km img,.cpel-switcher__flag--kw img,.cpel-switcher__flag--ky img,.cpel-switcher__flag--kz img,.cpel-switcher__flag--lk img,.cpel-switcher__flag--lr img,.cpel-switcher__flag--mg img,.cpel-switcher__flag--mh img,.cpel-switcher__flag--ms img,.cpel-switcher__flag--my img,.cpel-switcher__flag--mz img,.cpel-switcher__flag--na img,.cpel-switcher__flag--np img,.cpel-switcher__flag--nu img,.cpel-switcher__flag--nz img,.cpel-switcher__flag--om img,.cpel-switcher__flag--ph img,.cpel-switcher__flag--pm img,.cpel-switcher__flag--pn img,.cpel-switcher__flag--pr img,.cpel-switcher__flag--ps img,.cpel-switcher__flag--sb img,.cpel-switcher__flag--sc img,.cpel-switcher__flag--sd img,.cpel-switcher__flag--sg img,.cpel-switcher__flag--sh img,.cpel-switcher__flag--sk img,.cpel-switcher__flag--ss img,.cpel-switcher__flag--st img,.cpel-switcher__flag--tc img,.cpel-switcher__flag--tf img,.cpel-switcher__flag--tg img,.cpel-switcher__flag--tk img,.cpel-switcher__flag--tl img,.cpel-switcher__flag--to img,.cpel-switcher__flag--tv img,.cpel-switcher__flag--tw img,.cpel-switcher__flag--us img,.cpel-switcher__flag--uy img,.cpel-switcher__flag--uz img,.cpel-switcher__flag--vg img,.cpel-switcher__flag--vu img,.cpel-switcher__flag--ws img,.cpel-switcher__flag--za img,.cpel-switcher__flag--zw img{object-position:left}.cpel-switcher__flag--eh img,.cpel-switcher__flag--tm img{object-position:20%}.cpel-switcher__flag--ai img,.cpel-switcher__flag--au img,.cpel-switcher__flag--bm img,.cpel-switcher__flag--ck img,.cpel-switcher__flag--fj img,.cpel-switcher__flag--fk img,.cpel-switcher__flag--gs img,.cpel-switcher__flag--hm img,.cpel-switcher__flag--io img,.cpel-switcher__flag--ky img,.cpel-switcher__flag--ms img,.cpel-switcher__flag--nu img,.cpel-switcher__flag--nz img,.cpel-switcher__flag--pn img,.cpel-switcher__flag--sh img,.cpel-switcher__flag--tc img,.cpel-switcher__flag--tf img,.cpel-switcher__flag--tv img,.cpel-switcher__flag--vg img{object-position:75%}.cpel-switcher__flag--as img,.cpel-switcher__flag--zm img{object-position:right}
connect-polylang-elementor.php CHANGED
@@ -8,7 +8,7 @@
8
  * Plugin Name: Polylang Connect for Elementor
9
  * Plugin URI: https://github.com/creame/connect-polylang-elementor
10
  * Description: Connect Polylang with Elementor. Display templates in the correct language, language switcher widget, language visibility conditions and dynamic tags.
11
- * Version: 2.0.3
12
  * Author: Creame
13
  * Author URI: https://crea.me/
14
  * License: GPL-2.0-or-later
@@ -31,7 +31,7 @@ defined( 'ABSPATH' ) || exit;
31
  *
32
  * @since 2.0.0
33
  */
34
- define( 'CPEL_PLUGIN_VERSION', '2.0.3' );
35
  define( 'CPEL_FILE', __FILE__ );
36
  define( 'CPEL_DIR', plugin_dir_path( CPEL_FILE ) );
37
  define( 'CPEL_BASENAME', plugin_basename( CPEL_FILE ) );
8
  * Plugin Name: Polylang Connect for Elementor
9
  * Plugin URI: https://github.com/creame/connect-polylang-elementor
10
  * Description: Connect Polylang with Elementor. Display templates in the correct language, language switcher widget, language visibility conditions and dynamic tags.
11
+ * Version: 2.0.4
12
  * Author: Creame
13
  * Author URI: https://crea.me/
14
  * License: GPL-2.0-or-later
31
  *
32
  * @since 2.0.0
33
  */
34
+ define( 'CPEL_PLUGIN_VERSION', '2.0.4' );
35
  define( 'CPEL_FILE', __FILE__ );
36
  define( 'CPEL_DIR', plugin_dir_path( CPEL_FILE ) );
37
  define( 'CPEL_BASENAME', plugin_basename( CPEL_FILE ) );
includes/connect-plugins.php CHANGED
@@ -45,23 +45,29 @@ class ConnectPlugins {
45
  add_filter( 'get_post_metadata', array( $this, 'elementor_conditions_empty_on_translations' ), 10, 3 );
46
  add_filter( 'pre_update_option_elementor_pro_theme_builder_conditions', array( $this, 'theme_builder_conditions_remove_empty' ) );
47
 
48
- // Update template conditions on language terms change.
49
- add_action( 'set_object_terms', array( $this, 'update_conditions_on_term_change' ), 10, 4 );
50
-
51
  // Global widgets hide language column.
52
  add_action( 'manage_elementor_library_posts_custom_column', array( $this, 'hide_language_column_pre' ), 9, 2 );
53
  add_action( 'manage_elementor_library_posts_custom_column', array( $this, 'hide_language_column_pos' ), 11, 2 );
54
 
 
 
 
 
 
 
 
 
 
55
  // Don't add "_elementor_css" meta.
56
  add_filter( 'update_post_metadata', array( $this, 'prevent_elementor_css_meta' ), 10, 3 );
57
 
58
  }
59
 
60
- // Elementor editor menu lins to translations
61
  add_action( 'elementor/editor/after_enqueue_scripts', array( $this, 'elementor_editor_script' ) );
62
 
63
- // Elementor Theme Editor show template language
64
- add_filter( 'elementor-pro/site-editor/data/template', array( $this, 'elementor_theme_editor_title' ) );
65
 
66
  }
67
 
@@ -143,13 +149,7 @@ class ConnectPlugins {
143
  */
144
  function elementor_conditions_empty_on_translations( $null, $post_id, $meta_key ) {
145
 
146
- if ( '_elementor_conditions' === $meta_key ) {
147
-
148
- return cpel_is_translation( $post_id ) ? array( array() ) : $null;
149
-
150
- }
151
-
152
- return $null;
153
 
154
  }
155
 
@@ -241,9 +241,10 @@ class ConnectPlugins {
241
  */
242
  function update_conditions_on_term_change( $post_id, $terms, $tt_ids, $taxonomy ) {
243
 
244
- if ( cpel_is_elementor_pro_active() && 'post_translations' === $taxonomy && 'elementor_library' === get_post_type( $post_id ) ) {
245
 
246
- \ElementorPro\Modules\ThemeBuilder\Module::instance()->get_conditions_manager()->get_cache()->regenerate();
 
247
 
248
  }
249
 
@@ -262,12 +263,10 @@ class ConnectPlugins {
262
  */
263
  function hide_language_column_pre( $column, $post_id ) {
264
 
265
- if ( false === strpos( $column, 'language_' ) || 'widget' !== get_post_meta( $post_id, '_elementor_template_type', true ) ) {
266
- return;
267
  }
268
 
269
- echo '<span aria-hidden="true">—</span><div class="hidden" aria-hidden="true">';
270
-
271
  }
272
 
273
  /**
@@ -283,11 +282,50 @@ class ConnectPlugins {
283
  */
284
  function hide_language_column_pos( $column, $post_id ) {
285
 
286
- if ( false === strpos( $column, 'language_' ) || 'widget' !== get_post_meta( $post_id, '_elementor_template_type', true ) ) {
287
- return;
288
  }
289
 
290
- echo '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
 
292
  }
293
 
@@ -428,16 +466,40 @@ class ConnectPlugins {
428
  }
429
 
430
  /**
431
- * Elementor Theme Editor language on template title
432
  *
433
- * @since 2.0.0
 
 
434
  *
435
  * @param array $data
436
  * @return array
437
  */
438
- function elementor_theme_editor_title( $data ) {
 
 
 
 
 
 
 
 
 
 
439
 
440
- $data['title'] = sprintf( '%s (%s)', $data['title'], pll_get_post_language( $data['id'], 'slug' ) );
 
 
 
 
 
 
 
 
 
 
 
 
441
 
442
  return $data;
443
 
45
  add_filter( 'get_post_metadata', array( $this, 'elementor_conditions_empty_on_translations' ), 10, 3 );
46
  add_filter( 'pre_update_option_elementor_pro_theme_builder_conditions', array( $this, 'theme_builder_conditions_remove_empty' ) );
47
 
 
 
 
48
  // Global widgets hide language column.
49
  add_action( 'manage_elementor_library_posts_custom_column', array( $this, 'hide_language_column_pre' ), 9, 2 );
50
  add_action( 'manage_elementor_library_posts_custom_column', array( $this, 'hide_language_column_pos' ), 11, 2 );
51
 
52
+ if ( cpel_is_elementor_pro_active() ) {
53
+ // Update template conditions on language terms change.
54
+ add_action( 'set_object_terms', array( $this, 'update_conditions_on_term_change' ), 10, 4 );
55
+
56
+ // Translations conditions column.
57
+ add_action( 'manage_elementor_library_posts_custom_column', array( $this, 'instances_column_pre' ), 9, 2 );
58
+ add_action( 'manage_elementor_library_posts_custom_column', array( $this, 'instances_column_pos' ), 11, 2 );
59
+ }
60
+
61
  // Don't add "_elementor_css" meta.
62
  add_filter( 'update_post_metadata', array( $this, 'prevent_elementor_css_meta' ), 10, 3 );
63
 
64
  }
65
 
66
+ // Elementor editor menu links to translations
67
  add_action( 'elementor/editor/after_enqueue_scripts', array( $this, 'elementor_editor_script' ) );
68
 
69
+ // Elementor Site Editor template tweaks
70
+ add_filter( 'elementor-pro/site-editor/data/template', array( $this, 'elementor_site_editor_template' ) );
71
 
72
  }
73
 
149
  */
150
  function elementor_conditions_empty_on_translations( $null, $post_id, $meta_key ) {
151
 
152
+ return '_elementor_conditions' === $meta_key && cpel_is_translation( $post_id ) ? array( array() ) : $null;
 
 
 
 
 
 
153
 
154
  }
155
 
241
  */
242
  function update_conditions_on_term_change( $post_id, $terms, $tt_ids, $taxonomy ) {
243
 
244
+ if ( 'post_translations' === $taxonomy && 'elementor_library' === get_post_type( $post_id ) ) {
245
 
246
+ $theme_builder = \ElementorPro\Plugin::instance()->modules_manager->get_modules( 'theme-builder' );
247
+ $theme_builder->get_conditions_manager()->get_cache()->regenerate();
248
 
249
  }
250
 
263
  */
264
  function hide_language_column_pre( $column, $post_id ) {
265
 
266
+ if ( false !== strpos( $column, 'language_' ) && 'widget' === get_post_meta( $post_id, '_elementor_template_type', true ) ) {
267
+ echo '<span aria-hidden="true">—</span><div class="hidden" aria-hidden="true">';
268
  }
269
 
 
 
270
  }
271
 
272
  /**
282
  */
283
  function hide_language_column_pos( $column, $post_id ) {
284
 
285
+ if ( false !== strpos( $column, 'language_' ) && 'widget' === get_post_meta( $post_id, '_elementor_template_type', true ) ) {
286
+ echo '</div>';
287
  }
288
 
289
+ }
290
+
291
+ /**
292
+ * Show default language instances in translations
293
+ *
294
+ * (Also wrap "None" with a hidden div)
295
+ *
296
+ * @since 2.0.4
297
+ *
298
+ * @param string $column
299
+ * @param int $post_id
300
+ * @return void
301
+ */
302
+ function instances_column_pre( $column, $post_id ) {
303
+
304
+ if ( 'instances' === $column && cpel_is_translation( $post_id ) ) {
305
+
306
+ $conditions_manager = \ElementorPro\Plugin::instance()->modules_manager->get_modules( 'theme-builder' )->get_conditions_manager();
307
+ $instances = $conditions_manager->get_document_instances( pll_get_post( $post_id, pll_default_language() ) );
308
+
309
+ echo '<span style="opacity:.4">' . esc_html( implode( ', ', $instances ) ) . '</span><div class="hidden" aria-hidden="true">';
310
+
311
+ }
312
+
313
+ }
314
+
315
+ /**
316
+ * Show default language instances in translations (close)
317
+ *
318
+ * @since 2.0.4
319
+ *
320
+ * @param string $column
321
+ * @param int $post_id
322
+ * @return void
323
+ */
324
+ function instances_column_pos( $column, $post_id ) {
325
+
326
+ if ( 'instances' === $column && cpel_is_translation( $post_id ) ) {
327
+ echo '</div>';
328
+ }
329
 
330
  }
331
 
466
  }
467
 
468
  /**
469
+ * Elementor Site Editor template changes
470
  *
471
+ * at 2.0.0 named "elementor_theme_editor_title"
472
+ *
473
+ * @since 2.0.4
474
  *
475
  * @param array $data
476
  * @return array
477
  */
478
+ function elementor_site_editor_template( $data ) {
479
+
480
+ $post_id = $data['id'];
481
+
482
+ // Add lang info to title.
483
+ $data['title'] = sprintf( '%s / %s', $data['title'], strtoupper( pll_get_post_language( $post_id ) ) );
484
+
485
+ // Show default language instances in translations (and recalc isActive).
486
+ if ( cpel_is_translation( $post_id ) ) {
487
+
488
+ $language = pll_default_language();
489
 
490
+ $conditions_manager = \ElementorPro\Plugin::instance()->modules_manager->get_modules( 'theme-builder' )->get_conditions_manager();
491
+ $instances = $conditions_manager->get_document_instances( pll_get_post( $post_id, $language ) );
492
+
493
+ if ( empty( $instances ) ) {
494
+ $instances = array( 'no_instances' => esc_html__( 'No instances', 'elementor-pro' ) );
495
+ $is_active = false;
496
+ } else {
497
+ $is_active = 'publish' === $data['status'];
498
+ }
499
+
500
+ $data['instances'] = array( 'cpel' => sprintf( esc_html__( '(from %s)', 'connect-polylang-elementor' ), strtoupper( $language ) ) ) + $instances;
501
+ $data['isActive'] = $is_active;
502
+ }
503
 
504
  return $data;
505
 
languages/connect-polylang-elementor-es_ES.mo CHANGED
Binary file
languages/connect-polylang-elementor-es_ES.po CHANGED
@@ -3,9 +3,9 @@ msgstr ""
3
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
4
  "Project-Id-Version: Connect Polylang to Elementor\n"
5
  "POT-Creation-Date: 2021-05-14 10:09+0000\n"
6
- "PO-Revision-Date: 2022-01-31 17:25+0000\n"
7
  "Last-Translator: Pacotole <pacotole@crea.me>\n"
8
- "Language-Team: Spanish (Spain)\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -23,6 +23,11 @@ msgstr ""
23
  "X-Poedit-SearchPath-0: .\n"
24
  "X-Poedit-SearchPathExcluded-0: *.js\n"
25
 
 
 
 
 
 
26
  #: includes/finder/polylang-category.php:67
27
  msgid "All languages of your website"
28
  msgstr "Todos los idiomas de su web"
@@ -33,10 +38,14 @@ msgid "languages, switcher, polylang, multilingual, flags, countries, country"
33
  msgstr "idiomas, conmutador, polylang, multilingüe, banderas, países, país"
34
 
35
  #. Description of the plugin
 
 
 
 
 
36
  msgid ""
37
- "Connect Polylang with Elementor Page Builder. Display templates in the "
38
- "correct language, language switcher widget, widget language visibility "
39
- "settings and language dynamic tags."
40
  msgstr ""
41
  "Conecta Polylang con Elementor Page Builder. Muestra las plantillas en el "
42
  "idioma correcto, widget de selección de idioma, ajustes de visibilidad de "
@@ -51,10 +60,6 @@ msgstr "Creame"
51
  msgid "Current Language"
52
  msgstr "Idioma actual"
53
 
54
- #: includes/util/info.php:19
55
- msgid "David Decker - DECKERWEB"
56
- msgstr "David Decker - DECKERWEB"
57
-
58
  #: includes/widgets/polylang-language-switcher.php:262
59
  #| msgid "Displays language code"
60
  msgid "Displays language codes"
@@ -81,7 +86,7 @@ msgid "Language URL"
81
  msgstr "URL de idioma"
82
 
83
  #. Title attribute for Elementor My Templates link
84
- #: includes/admin-extras.php:70
85
  msgid "Elementor My Templates"
86
  msgstr "Elementor Mis Plantillas"
87
 
@@ -114,12 +119,12 @@ msgstr "Nombre de idioma"
114
  msgid "Language Visibility"
115
  msgstr "Visibilidad de idioma"
116
 
117
- #: includes/admin-extras.php:71
118
  msgctxt "Link title attribute for Elementor My Templates"
119
  msgid "Templates"
120
  msgstr "Plantillas"
121
 
122
- #: includes/admin-extras.php:58
123
  msgctxt "Link title attribute for Polylang settings"
124
  msgid "Languages"
125
  msgstr "Idiomas"
@@ -138,7 +143,7 @@ msgid "Polylang Connect for Elementor"
138
  msgstr "Polylang Connect para Elementor"
139
 
140
  #. Title attribute for Polylang settings link
141
- #: includes/admin-extras.php:57
142
  msgid "Polylang Languages Setup"
143
  msgstr "Configuración de idiomas de Polylang"
144
 
3
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
4
  "Project-Id-Version: Connect Polylang to Elementor\n"
5
  "POT-Creation-Date: 2021-05-14 10:09+0000\n"
6
+ "PO-Revision-Date: 2022-02-23 17:03+0000\n"
7
  "Last-Translator: Pacotole <pacotole@crea.me>\n"
8
+ "Language-Team: Español\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
23
  "X-Poedit-SearchPath-0: .\n"
24
  "X-Poedit-SearchPathExcluded-0: *.js\n"
25
 
26
+ #: includes/connect-plugins.php:498
27
+ #, php-format
28
+ msgid "(from %s)"
29
+ msgstr "(desde %s)"
30
+
31
  #: includes/finder/polylang-category.php:67
32
  msgid "All languages of your website"
33
  msgstr "Todos los idiomas de su web"
38
  msgstr "idiomas, conmutador, polylang, multilingüe, banderas, países, país"
39
 
40
  #. Description of the plugin
41
+ #, fuzzy
42
+ #| msgid ""
43
+ #| "Connect Polylang with Elementor Page Builder. Display templates in the "
44
+ #| "correct language, language switcher widget, widget language visibility "
45
+ #| "settings and language dynamic tags."
46
  msgid ""
47
+ "Connect Polylang with Elementor. Display templates in the correct language, "
48
+ "language switcher widget, language visibility conditions and dynamic tags."
 
49
  msgstr ""
50
  "Conecta Polylang con Elementor Page Builder. Muestra las plantillas en el "
51
  "idioma correcto, widget de selección de idioma, ajustes de visibilidad de "
60
  msgid "Current Language"
61
  msgstr "Idioma actual"
62
 
 
 
 
 
63
  #: includes/widgets/polylang-language-switcher.php:262
64
  #| msgid "Displays language code"
65
  msgid "Displays language codes"
86
  msgstr "URL de idioma"
87
 
88
  #. Title attribute for Elementor My Templates link
89
+ #: includes/admin-extras.php:63
90
  msgid "Elementor My Templates"
91
  msgstr "Elementor Mis Plantillas"
92
 
119
  msgid "Language Visibility"
120
  msgstr "Visibilidad de idioma"
121
 
122
+ #: includes/admin-extras.php:64
123
  msgctxt "Link title attribute for Elementor My Templates"
124
  msgid "Templates"
125
  msgstr "Plantillas"
126
 
127
+ #: includes/admin-extras.php:51
128
  msgctxt "Link title attribute for Polylang settings"
129
  msgid "Languages"
130
  msgstr "Idiomas"
143
  msgstr "Polylang Connect para Elementor"
144
 
145
  #. Title attribute for Polylang settings link
146
+ #: includes/admin-extras.php:50
147
  msgid "Polylang Languages Setup"
148
  msgstr "Configuración de idiomas de Polylang"
149
 
languages/connect-polylang-elementor.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: Connect Polylang to Elementor\n"
6
- "POT-Creation-Date: 2022-01-31 17:25+0000\n"
7
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
  "Last-Translator: David Decker DECKERWEB.de -- https://deckerweb.de/\n"
9
  "Language-Team: David Decker DECKERWEB.de -- https://deckerweb.de/\n"
@@ -22,6 +22,11 @@ msgstr ""
22
  "X-Poedit-SearchPathExcluded-0: *.js\n"
23
  "Language: "
24
 
 
 
 
 
 
25
  #: includes/finder/polylang-category.php:67
26
  msgid "All languages of your website"
27
  msgstr ""
@@ -33,9 +38,8 @@ msgstr ""
33
 
34
  #. Description of the plugin
35
  msgid ""
36
- "Connect Polylang with Elementor Page Builder. Display templates in the "
37
- "correct language, language switcher widget, widget language visibility "
38
- "settings and language dynamic tags."
39
  msgstr ""
40
 
41
  #. Author of the plugin
@@ -47,10 +51,6 @@ msgstr ""
47
  msgid "Current Language"
48
  msgstr ""
49
 
50
- #: includes/util/info.php:19
51
- msgid "David Decker - DECKERWEB"
52
- msgstr ""
53
-
54
  #: includes/widgets/polylang-language-switcher.php:262
55
  msgid "Displays language codes"
56
  msgstr ""
@@ -76,7 +76,7 @@ msgid "Language URL"
76
  msgstr ""
77
 
78
  #. Title attribute for Elementor My Templates link
79
- #: includes/admin-extras.php:70
80
  msgid "Elementor My Templates"
81
  msgstr ""
82
 
@@ -108,12 +108,12 @@ msgstr ""
108
  msgid "Language Visibility"
109
  msgstr ""
110
 
111
- #: includes/admin-extras.php:71
112
  msgctxt "Link title attribute for Elementor My Templates"
113
  msgid "Templates"
114
  msgstr ""
115
 
116
- #: includes/admin-extras.php:58
117
  msgctxt "Link title attribute for Polylang settings"
118
  msgid "Languages"
119
  msgstr ""
@@ -131,7 +131,7 @@ msgid "Polylang Connect for Elementor"
131
  msgstr ""
132
 
133
  #. Title attribute for Polylang settings link
134
- #: includes/admin-extras.php:57
135
  msgid "Polylang Languages Setup"
136
  msgstr ""
137
 
3
  msgstr ""
4
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
5
  "Project-Id-Version: Connect Polylang to Elementor\n"
6
+ "POT-Creation-Date: 2022-02-23 17:02+0000\n"
7
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
8
  "Last-Translator: David Decker DECKERWEB.de -- https://deckerweb.de/\n"
9
  "Language-Team: David Decker DECKERWEB.de -- https://deckerweb.de/\n"
22
  "X-Poedit-SearchPathExcluded-0: *.js\n"
23
  "Language: "
24
 
25
+ #: includes/connect-plugins.php:498
26
+ #, php-format
27
+ msgid "(from %s)"
28
+ msgstr ""
29
+
30
  #: includes/finder/polylang-category.php:67
31
  msgid "All languages of your website"
32
  msgstr ""
38
 
39
  #. Description of the plugin
40
  msgid ""
41
+ "Connect Polylang with Elementor. Display templates in the correct language, "
42
+ "language switcher widget, language visibility conditions and dynamic tags."
 
43
  msgstr ""
44
 
45
  #. Author of the plugin
51
  msgid "Current Language"
52
  msgstr ""
53
 
 
 
 
 
54
  #: includes/widgets/polylang-language-switcher.php:262
55
  msgid "Displays language codes"
56
  msgstr ""
76
  msgstr ""
77
 
78
  #. Title attribute for Elementor My Templates link
79
+ #: includes/admin-extras.php:63
80
  msgid "Elementor My Templates"
81
  msgstr ""
82
 
108
  msgid "Language Visibility"
109
  msgstr ""
110
 
111
+ #: includes/admin-extras.php:64
112
  msgctxt "Link title attribute for Elementor My Templates"
113
  msgid "Templates"
114
  msgstr ""
115
 
116
+ #: includes/admin-extras.php:51
117
  msgctxt "Link title attribute for Polylang settings"
118
  msgid "Languages"
119
  msgstr ""
131
  msgstr ""
132
 
133
  #. Title attribute for Polylang settings link
134
+ #: includes/admin-extras.php:50
135
  msgid "Polylang Languages Setup"
136
  msgstr ""
137