WC_Settings_Advanced::get_settings_for_legacy_api_section()protectedWC 1.0

Get settings for the legacy API section.

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

Хуки из метода

Возвращает

Массив.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_settings_for_legacy_api_section();

Код WC_Settings_Advanced::get_settings_for_legacy_api_section() WC 8.9.0

protected function get_settings_for_legacy_api_section() {
	$enable_legacy_api_setting = array(
		'title'   => __( 'Legacy API', 'woocommerce' ),
		'desc'    => __( 'Enable the legacy REST API', 'woocommerce' ),
		'id'      => 'woocommerce_api_enabled',
		'type'    => 'checkbox',
		'default' => 'no',
	);

	if ( ! is_plugin_active( 'woocommerce-legacy-rest-api/woocommerce-legacy-rest-api.php' ) ) {
		$enable_legacy_api_setting['desc_tip'] = sprintf(
		// translators: Placeholders are URLs.
			__(
				'⚠️ <b>️The Legacy REST API will be removed in WooCommerce 9.0.</b> <a target="_blank" href="%1$s">A separate WooCommerce extension is available</a> to keep it enabled. You can check Legacy REST API usages in <b><a target="_blank" href="%2$s">the WooCommerce log files</a></b> (file names start with <code>legacy_rest_api_usages</code>). <b><a target="_blank" href="%3$s">Learn more about this change.</a></b>',
				'woocommerce'
			),
			'https://wordpress.org/plugins/woocommerce-legacy-rest-api/',
			admin_url( 'admin.php?page=wc-status&tab=logs' ),
			'https://developer.woocommerce.com/2023/10/03/the-legacy-rest-api-will-move-to-a-dedicated-extension-in-woocommerce-9-0/'
		);
	}

	$settings =
		array(
			array(
				'title' => '',
				'type'  => 'title',
				'desc'  => '',
				'id'    => 'legacy_api_options',
			),
			$enable_legacy_api_setting,
			array(
				'type' => 'sectionend',
				'id'   => 'legacy_api_options',
			),
		);

	return apply_filters( 'woocommerce_settings_rest_api', $settings );
}