<?php
/**
 * Alpine init-code field — Pro overlay only. Not packaged in Lite.
 *
 * @package AlpineJsEnqueue
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! isset( $module_id ) || ! is_string( $module_id ) || $module_id === '' ) {
	return;
}

$init_code = isset( $settings['init_code'] ) && is_string( $settings['init_code'] )
	? $settings['init_code']
	: '';
?>
				<tr>
					<th scope="row">
						<label for="<?php echo esc_attr( $module_id ); ?>_init_code"><?php esc_html_e( 'Initialization Code', 'wppowersuite-lite' ); ?></label>
					</th>
					<td>
						<textarea
							id="<?php echo esc_attr( $module_id ); ?>_init_code"
							name="init_code"
							class="large-text code wp-powersuite-advanced-setting"
							data-setting-key="init_code"
							rows="10"
							placeholder="<?php esc_attr_e( "Alpine.data('counter', () => ({\n  count: 0,\n  increment() { this.count++; }\n}));", 'wppowersuite-lite' ); ?>"
						><?php echo esc_textarea( $init_code ); ?></textarea>
						<p class="description">
							<?php esc_html_e( 'Runs on the alpine:init event after Alpine loads. Requires the unfiltered_html capability to save. Useful for Alpine.data(), Alpine.store(), Alpine.plugin(), and Alpine.config().', 'wppowersuite-lite' ); ?>
						</p>
					</td>
				</tr>
