GC_Customize_Widgets::filter_gc_kses_allowed_data_attributes()

最后更新于:2021-11-27 10:32:05

GC_Customize_Widgets::filter_gc_kses_allowed_data_attributes( array$allowed_html)

Ensures the HTML data-* attributes for selective refresh are allowed by kses.

参数

$allowed_html

(array) (Required) Allowed HTML.

响应

(array) (Maybe) modified allowed HTML.

源文件

文件: gc-includes/class-gc-customize-widgets.php

	public function filter_gc_kses_allowed_data_attributes( $allowed_html ) {
		foreach ( array_keys( $this->before_widget_tags_seen ) as $tag_name ) {
			if ( ! isset( $allowed_html[ $tag_name ] ) ) {
				$allowed_html[ $tag_name ] = array();
			}
			$allowed_html[ $tag_name ] = array_merge(
				$allowed_html[ $tag_name ],
				array_fill_keys(
					array(
						'data-customize-partial-id',
						'data-customize-partial-type',
						'data-customize-partial-placement-context',
						'data-customize-partial-widget-id',
						'data-customize-partial-options',
					),
					true
				)
			);
		}
		return $allowed_html;
	}