/** * Display settings page with some additional javascript for hiding * conditional fields. The "Require CSC" field will be shown only when * the "Enable CSC" and "Tokenization" are enabled * * @since 1.0 * @see SV_WC_Payment_Gateway::admin_options() */ public function admin_options() { parent::admin_options(); // add inline javascript to show the "require csc" field when the "enable csc" and "tokenization" fields are both checked ob_start(); ?> $( '#woocommerce_<?php echo $this->get_id(); ?> _enable_csc, #woocommerce_<?php echo $this->get_id(); ?> _tokenization' ).change( function() { if ( $( '#woocommerce_<?php echo $this->get_id(); ?> _enable_csc' ).is( ':checked' ) && $( '#woocommerce_<?php echo $this->get_id(); ?> _tokenization' ).is( ':checked' ) ) { $( '#woocommerce_<?php echo $this->get_id(); ?> _require_csc' ).closest( 'tr' ).show(); } else { $( '#woocommerce_<?php echo $this->get_id(); ?> _require_csc' ).closest( 'tr' ).hide(); } } ).change(); <?php wc_enqueue_js(ob_get_clean()); }