woocommerce_generate_(type)_html хук-фильтрWC 6.5.0

Allow the generation of custom field types on the settings screen.

The dynamic portion of the hook name refers to the slug of the custom field type. For instance, to introduce a new field type fancy_lazy_dropdown you would use the hook woocommerce_generate_fancy_lazy_dropdown_html.

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

add_filter( 'woocommerce_generate_(type)_html', 'wp_kama_woocommerce_generate_type_html_filter', 10, 4 );

/**
 * Function for `woocommerce_generate_(type)_html` filter-hook.
 * 
 * @param string $field_html  The markup of the field being generated (initiated as an empty string).
 * @param string $key         The key of the field.
 * @param array  $data        The attributes of the field as an associative array.
 * @param object $wc_settings The current WC_Settings_API object.
 *
 * @return string
 */
function wp_kama_woocommerce_generate_type_html_filter( $field_html, $key, $data, $wc_settings ){

	// filter...
	return $field_html;
}
$field_html(строка)
The markup of the field being generated (initiated as an empty string).
$key(строка)
The key of the field.
$data(массив)
The attributes of the field as an associative array.
$wc_settings(объект)
The current WC_Settings_API object.

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

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

Где вызывается хук

WC_Settings_API::generate_settings_html()
woocommerce_generate_(type)_html
woocommerce/includes/abstracts/abstract-wc-settings-api.php 364
$html .= apply_filters( 'woocommerce_generate_' . $type . '_html', '', $k, $v, $this );

Где используется хук в WooCommerce

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