Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

PaymentGateway::get_titlepublicWC 1.0

Get the provider title of the payment gateway.

This is the intended gateway title to use throughout the WC admin. It should be short.

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

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

Хуков нет.

Возвращает

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

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

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

Код PaymentGateway::get_title() WC 10.5.2

public function get_title( WC_Payment_Gateway $payment_gateway ): string {
	$title = $payment_gateway->get_method_title();
	// If we still couldn't get the WC admin title, fall back to the main title.
	if ( ! is_string( $title ) || empty( $title ) ) {
		$title = $payment_gateway->get_title();
	}
	// If we still couldn't get the title, return a default value.
	if ( ! is_string( $title ) || empty( $title ) ) {
		return esc_html__( 'Unknown', 'woocommerce' );
	}

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

	// Truncate the title.
	return Utils::truncate_with_words( $title, 75 );
}