WP_Widget_Custom_HTML::render_control_template_scripts()public staticWP 4.9.0

Render form template scripts.

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

Хуков нет.

Возвращает

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

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

$result = WP_Widget_Custom_HTML::render_control_template_scripts();

Список изменений

С версии 4.9.0 Введена.

Код WP_Widget_Custom_HTML::render_control_template_scripts() WP 6.5.2

<?php
public static function render_control_template_scripts() {
	?>
	<script type="text/html" id="tmpl-widget-custom-html-control-fields">
		<# var elementIdPrefix = 'el' + String( Math.random() ).replace( /\D/g, '' ) + '_' #>
		<p>
			<label for="{{ elementIdPrefix }}title"><?php esc_html_e( 'Title:' ); ?></label>
			<input id="{{ elementIdPrefix }}title" type="text" class="widefat title">
		</p>

		<p>
			<label for="{{ elementIdPrefix }}content" id="{{ elementIdPrefix }}content-label"><?php esc_html_e( 'Content:' ); ?></label>
			<textarea id="{{ elementIdPrefix }}content" class="widefat code content" rows="16" cols="20"></textarea>
		</p>

		<?php if ( ! current_user_can( 'unfiltered_html' ) ) : ?>
			<?php
			$probably_unsafe_html = array( 'script', 'iframe', 'form', 'input', 'style' );
			$allowed_html         = wp_kses_allowed_html( 'post' );
			$disallowed_html      = array_diff( $probably_unsafe_html, array_keys( $allowed_html ) );
			?>
			<?php if ( ! empty( $disallowed_html ) ) : ?>
				<# if ( data.codeEditorDisabled ) { #>
					<p>
						<?php _e( 'Some HTML tags are not permitted, including:' ); ?>
						<code><?php echo implode( '</code>, <code>', $disallowed_html ); ?></code>
					</p>
				<# } #>
			<?php endif; ?>
		<?php endif; ?>

		<div class="code-editor-error-container"></div>
	</script>
	<?php
}