Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

PaymentGateway::get_descriptionpublicWC 1.0

Get the provider description of the payment gateway.

This is the intended gateway description to use throughout the WC admin. It should be short and to the point.

Note: We don't allow HTML tags in the description. All HTML tags will be stripped, including their contents.

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

Хуков нет.

Возвращает

Строку. The provider description of the payment gateway.

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

$PaymentGateway = new PaymentGateway();
$PaymentGateway->get_description( $payment_gateway ): string;
$payment_gateway(WC_Payment_Gateway) (обязательный)
The payment gateway object.

Код PaymentGateway::get_description() WC 10.5.0

public function get_description( WC_Payment_Gateway $payment_gateway ): string {
	$description = $payment_gateway->get_method_description();
	// If we couldn't get the WC admin description, fall back to the main description.
	if ( ! is_string( $description ) || empty( $description ) ) {
		$description = $payment_gateway->get_description();
	}
	// If we still couldn't get the description, use an empty string since the description is not critical.
	if ( ! is_string( $description ) || empty( $description ) ) {
		return '';
	}

	// No HTML tags allowed in the description.
	$description = wp_strip_all_tags( html_entity_decode( $description, ENT_QUOTES | ENT_SUBSTITUTE ), true );

	// Truncate the description.
	return Utils::truncate_with_words( $description, 130, '…' );
}