Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

PaymentGateway::get_description │ public │ WC 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.

Method of the class: PaymentGateway{}

No Hooks.

Returns

string. The provider description of the payment gateway.

Usage

$PaymentGateway = new PaymentGateway();
$PaymentGateway->get_description( $payment_gateway ): string;
$payment_gateway(WC_Payment_Gateway) (required)
The payment gateway object.

PaymentGateway::get_description() code WC 11.2.1

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, '…' );
}