GC_Customize_Widgets::get_selective_refreshable_widgets()

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

GC_Customize_Widgets::get_selective_refreshable_widgets()

List whether each registered widget can be use selective refresh.

响应

(array) Mapping of id_base to support. If theme doesn’t support selective refresh, an empty array is returned.

源文件

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

	public function get_selective_refreshable_widgets() {
		global $gc_widget_factory;
		if ( ! current_theme_supports( 'customize-selective-refresh-widgets' ) ) {
			return array();
		}
		if ( ! isset( $this->selective_refreshable_widgets ) ) {
			$this->selective_refreshable_widgets = array();
			foreach ( $gc_widget_factory->widgets as $gc_widget ) {
				$this->selective_refreshable_widgets[ $gc_widget->id_base ] = ! empty( $gc_widget->widget_options['customize_selective_refresh'] );
			}
		}
		return $this->selective_refreshable_widgets;
	}