WC_Updates_Screen_Updates::update_screen_modal_js()protectedWC 1.0

JS for the modal window on the updates screen.

Метод класса: WC_Updates_Screen_Updates{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->update_screen_modal_js();

Код WC_Updates_Screen_Updates::update_screen_modal_js() WC 8.7.0

<?php
protected function update_screen_modal_js() {
	?>
	<script>
		( function( $ ) {
			var modal_dismissed = false;

			// Show the modal if the WC upgrade checkbox is checked.
			var show_modal_if_checked = function() {
				if ( modal_dismissed ) {
					return;
				}
				var $checkbox = $( 'input[value="woocommerce/woocommerce.php"]' );
				if ( $checkbox.prop( 'checked' ) ) {
					$( '#wc-upgrade-warning' ).trigger( 'click' );
				}
			}

			$( '#plugins-select-all, input[value="woocommerce/woocommerce.php"]' ).on( 'change', function() {
				show_modal_if_checked();
			} );

			// Add a hidden thickbox link to use for bringing up the modal.
			$('body').append( '<a href="#TB_inline?height=600&width=550&inlineId=wc_untested_extensions_modal" class="wc-thickbox" id="wc-upgrade-warning" style="display:none"></a>' );

			// Don't show the modal again once it's been accepted.
			$( '#wc_untested_extensions_modal .accept' ).on( 'click', function( evt ) {
				evt.preventDefault();
				modal_dismissed = true;
				tb_remove();
			});

			// Uncheck the WC update checkbox if the modal is canceled.
			$( '#wc_untested_extensions_modal .cancel' ).on( 'click', function( evt ) {
				evt.preventDefault();
				$( 'input[value="woocommerce/woocommerce.php"]' ).prop( 'checked', false );
				tb_remove();
			});
		})( jQuery );
	</script>
	<?php
	$this->generic_modal_js();
}