';
$output .= '
';
$output .= $this->render_payment_method_icons( $attributes );
$output .= '
';
$output .= '
';
return $output;
}
/**
* Render payment method icons.
*
* @param array $attributes Block attributes.
* @return string Rendered block type output.
*/
private function render_payment_method_icons( $attributes ) {
$output = '';
$all_payment_methods = $this->get_available_payment_methods();
$number_of_icons = $attributes['numberOfIcons'] ?? 0;
if ( 0 === $number_of_icons ) {
$number_of_icons = count( $all_payment_methods );
} else {
$number_of_icons = max( 0, min( intval( $number_of_icons ), count( $all_payment_methods ) ) );
}
if ( ! empty( $all_payment_methods ) ) {
for ( $i = 0; $i < $number_of_icons; $i++ ) {
$payment_method = $all_payment_methods[ $i ];
$output .= '