GC_Customize_Control::get_link()

最后更新于:2021-11-26 23:31:20

GC_Customize_Control::get_link( string$setting_key=’default’)

Get the data link attribute for a setting.

参数

$setting_key

(string) (Optional)

Default value: ‘default’

响应

(string) Data link parameter, a data-customize-setting-link attribute if the $setting_key refers to a pre-registered setting, and a data-customize-setting-key-link attribute if the setting is not yet registered.

源文件

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

	public function get_link( $setting_key = 'default' ) {
		if ( isset( $this->settings[ $setting_key ] ) && $this->settings[ $setting_key ] instanceof GC_Customize_Setting ) {
			return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"';
		} else {
			return 'data-customize-setting-key-link="' . esc_attr( $setting_key ) . '"';
		}
	}