Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Mar 20, 2024
1 parent e8e8b3f commit e8918d6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public static function get_gateways() {
$gateways[] = [
'id' => $woo_id,
'payment_method' => $payment_method->get_id(),
'icon' => \array_key_exists( 'woocommerce', $payment_method->images ) ? $payment_method->images['woocommerce'] : '',
'icon_path' => \array_key_exists( 'woocommerce', $payment_method->images ) ? $payment_method->images['woocommerce'] : '',
'method_description' => \array_key_exists( 'default', $payment_method->descriptions ) ? $payment_method->descriptions['default'] : '',
'check_active' => ! \in_array(
$payment_method->get_id(),
Expand Down
23 changes: 23 additions & 0 deletions src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,29 @@ public function __construct( $args = [] ) {
if ( $this->supports( 'subscriptions' ) ) {
\add_action( 'woocommerce_scheduled_subscription_payment_' . $this->id, [ $this, 'process_subscription_payment' ], 10, 2 );
}

/**
* Icon display.
*
* @link https://github.com/pronamic/wp-pronamic-pay-woocommerce/issues/66
*/
$icon_display = $this->get_pronamic_option( 'icon_display' );

if ( '' === $icon_display && '' === $this->icon ) {
$icon_display = 'default';
}

if ( '' === $icon_display && '' !== $this->icon ) {
$icon_display = 'custom';
}

if ( 'default' === $icon_display && \array_key_exists( 'icon', $args ) && '' !== $args['icon_path'] ) {
$this->icon = \get_block_asset_url( \realpath( $args['icon_path'] ) );
}

if ( 'none' === $icon_display ) {
$this->icon = '';
}
}

/**
Expand Down

0 comments on commit e8918d6

Please sign in to comment.