29 'sitepress-post-edit',
30 'sitepress-post-list-quickedit',
31 'sitepress-languages',
32 'sitepress-troubleshooting',
65 add_filter(
'icl_ls_languages', array( $this,
'wpml_ls_filter' ) );
67 add_filter(
'gravityview_directory_link', array( $this,
'filter_gravityview_back_link') );
85 global $wpml_url_filters;
87 if( $wpml_url_filters ) {
102 global $wpml_url_filters;
104 if( ! $wpml_url_filters ) {
109 if ( method_exists( $wpml_url_filters,
'remove_global_hooks' ) ) {
110 $wpml_url_filters->remove_global_hooks();
112 gravityview()->log->error(
'WPML missing remove_global_hooks method. Needs version 3.6.2+.' );
115 if ( $wpml_url_filters->frontend_uses_root() === true ) {
116 remove_filter(
'page_link', array( $wpml_url_filters,
'page_link_filter_root' ), 1 );
118 remove_filter(
'page_link', array( $wpml_url_filters,
'page_link_filter' ), 1 );
130 global $wpml_url_filters;
132 if( ! $wpml_url_filters ) {
137 if ( method_exists( $wpml_url_filters,
'add_global_hooks' ) ) {
138 $wpml_url_filters->add_global_hooks();
140 gravityview()->log->error(
'WPML missing add_global_hooks method. Needs version 3.6.2+.' );
143 if ( $wpml_url_filters->frontend_uses_root() === true ) {
144 add_filter(
'page_link', array( $wpml_url_filters,
'page_link_filter_root' ), 1, 2 );
146 add_filter(
'page_link', array( $wpml_url_filters,
'page_link_filter' ), 1, 2 );
166 global $sitepress,
$post, $wpml_url_converter;
168 if ( ! method_exists( $sitepress,
'get_setting' ) ) {
169 gravityview()->log->error(
'This version of WPML is outdated and does not include the required method get_setting().' );
182 $trid = $sitepress->get_element_trid( $post->ID );
183 $translations = $sitepress->get_element_translations( $trid );
185 if ( ! $translations ) {
189 $language_url_setting = $sitepress->get_setting(
'language_negotiation_type' );
193 foreach ( $languages as $lang_code => $language ) {
195 if ( ! isset( $translations[ $lang_code ] ) || ! is_object( $translations[ $lang_code ] ) ) {
199 $lang_post_id = $translations[ $lang_code ]->element_id;
204 switch ( intval( $language_url_setting ) ) {
210 $entry_link = $wpml_url_converter->convert_url( $entry_link, $lang_code );
216 if ( ! empty( $translations[ $lang_code ]->original ) ) {
219 $entry_link = remove_query_arg(
'lang', $entry_link );
221 } elseif ( $entry_link ) {
224 $entry_link = add_query_arg( array(
'lang' => $lang_code ), $entry_link );
229 $languages[ $lang_code ][
'url'] = $entry_link;
filter_gravityview_back_link( $link)
Add WPML filters to GravityView directory link.
wpml_ls_filter( $languages)
Modify the language links to fix /entry/ var from being stripped.
add_url_hooks()
Add the WPML permalink filters back in.
if( $add_query_args) $link
add_hooks()
Add filters for WPML links.
Requires WPML 3.6.2 or newer.
gravityview()
The main GravityView wrapper function.
Abstract class that makes it easy for plugins and themes to register no-conflict scripts and styles...
static entry_link( $entry, $post_id=NULL, $add_directory_args=true, $view_id=0)
return href for single entry
new GravityView_Theme_Hooks_WPML
remove_url_hooks()
Remove WPML permalink filters.
static getInstance()
Get the one true instantiated self.