Automattic\WooCommerce\Blocks\BlockTypes
PaymentMethodIcons::get_other_payment_method_icons
Get other payment method icons from available gateways.
Метод класса: PaymentMethodIcons{}
Хуков нет.
Возвращает
Массив. Other payment method icons.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_other_payment_method_icons();
Код PaymentMethodIcons::get_other_payment_method_icons() PaymentMethodIcons::get other payment method icons WC 11.0.1
private function get_other_payment_method_icons() {
$available_gateways = WC()->payment_gateways->get_available_payment_gateways();
$other_payment_methods = array();
if ( empty( $available_gateways ) ) {
return $other_payment_methods;
}
foreach ( $available_gateways as $gateway ) {
if ( 'yes' === $gateway->enabled ) {
if ( 'woocommerce_payments' === $gateway->id ) {
continue;
}
$icon_url = '';
if ( is_callable( array( $gateway, 'get_icon_url' ) ) ) {
$icon_url = $gateway->get_icon_url();
}
if ( ! empty( $icon_url ) ) {
$other_payment_methods[] = array(
'name' => $gateway->get_title(),
'icon' => $icon_url,
);
}
}
}
usort(
$other_payment_methods,
function ( $a, $b ) {
return strcmp( $a['name'], $b['name'] );
}
);
return $other_payment_methods;
}