WC_Settings_Accounts::output()publicWC 1.0

Output the HTML for the settings.

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

Хуков нет.

Возвращает

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

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

$WC_Settings_Accounts = new WC_Settings_Accounts();
$WC_Settings_Accounts->output();

Код WC_Settings_Accounts::output() WC 9.4.2

<?php
public function output() {
	parent::output();

	// The following code toggles disabled state on the account options based on other values.
	?>
	<script type="text/javascript">
		document.addEventListener('DOMContentLoaded', function() {
			const checkboxes = [
				document.getElementById("woocommerce_enable_signup_and_login_from_checkout"),
				document.getElementById("woocommerce_enable_myaccount_registration"),
				document.getElementById("woocommerce_enable_signup_from_checkout_for_subscriptions")
			];
			const inputs = [
				document.getElementById("woocommerce_registration_generate_username"),
				document.getElementById("woocommerce_registration_generate_password")
			];

			function updateInputs() {
				const isChecked = checkboxes.some(cb => cb && cb.checked);
				inputs.forEach(input => {
					if ( ! input ) {
						return;
					}
					input.disabled = !isChecked;
					input.closest('td').classList.toggle("disabled", !isChecked);
				});
			}

			checkboxes.forEach(cb => cb && cb.addEventListener('change', updateInputs));
			updateInputs(); // Initial state
		});
	</script>
	<?php
}