Skip to content

Commit cfaa2f0

Browse files
committed
Add new filter: "redux/{opt_name}/field/typography/google_font_update" to disable Google FOnt updates.
1 parent 40b2cd0 commit cfaa2f0

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

redux-core/inc/fields/typography/class-redux-typography.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -786,14 +786,17 @@ class="span2 redux-typography redux-typography-margin-bottom mini typography-inp
786786
$in_use = '0';
787787
}
788788

789-
if ( Redux_Helpers::google_fonts_update_needed() && ! get_option( 'auto_update_redux_google_fonts', false ) && $this->field['font-family'] && $this->field['google'] ) {
790-
$nonce = wp_create_nonce( 'redux_update_google_fonts' );
791-
792-
echo '<div data-nonce="' . esc_attr( $nonce ) . '" class="redux-update-google-fonts update-message notice inline notice-warning notice-alt">';
793-
echo '<p>' . esc_html__( 'Your Google Fonts are out of date. To update them, please click one of the following:', 'redux-framework' );
794-
echo '&nbsp;<a href="#" class="update-google-fonts" data-action="automatic" aria-label="' . esc_attr__( 'Automated updates', 'redux-framework' ) . '">' . esc_html__( 'Automated updates', 'redux-framework' ) . '</a> ' . esc_html__( 'or', 'redux-framework' ) . ' <a href="#" class="update-google-fonts" data-action="manual" aria-label="' . esc_attr__( 'one-time update', 'redux-framework' ) . '">' . esc_html__( 'one-time update', 'redux-framework' ) . '</a>.';
795-
echo '</p>';
796-
echo '</div>';
789+
// Filter to disable Google font updates.
790+
if ( apply_filters( "redux/{$this->parent->args['opt_name']}/field/typography/google_font_update", true ) ) { // phpcs:ignored WordPress.NamingConventions.ValidHookName
791+
if ( Redux_Helpers::google_fonts_update_needed() && ! get_option( 'auto_update_redux_google_fonts', false ) && $this->field['font-family'] && $this->field['google'] ) {
792+
$nonce = wp_create_nonce( 'redux_update_google_fonts' );
793+
794+
echo '<div data-nonce="' . esc_attr( $nonce ) . '" class="redux-update-google-fonts update-message notice inline notice-warning notice-alt">';
795+
echo '<p>' . esc_html__( 'Your Google Fonts are out of date. To update them, please click one of the following:', 'redux-framework' );
796+
echo '&nbsp;<a href="#" class="update-google-fonts" data-action="automatic" aria-label="' . esc_attr__( 'Automated updates', 'redux-framework' ) . '">' . esc_html__( 'Automated updates', 'redux-framework' ) . '</a> ' . esc_html__( 'or', 'redux-framework' ) . ' <a href="#" class="update-google-fonts" data-action="manual" aria-label="' . esc_attr__( 'one-time update', 'redux-framework' ) . '">' . esc_html__( 'one-time update', 'redux-framework' ) . '</a>.';
797+
echo '</p>';
798+
echo '</div>';
799+
}
797800
}
798801

799802
echo '<p data-preview-size="' . esc_attr( $in_use ) . '" class="clear ' . esc_attr( $this->field['id'] ) . '_previewer typography-preview" style="' . esc_attr( $style ) . '">' . esc_html( $g_text ) . '</p>';

0 commit comments

Comments
 (0)