diff --git a/src/Settings/MollieSettingsPage.php b/src/Settings/MollieSettingsPage.php index cafb4ac8..279cd56f 100644 --- a/src/Settings/MollieSettingsPage.php +++ b/src/Settings/MollieSettingsPage.php @@ -10,6 +10,7 @@ use Mollie\WooCommerce\Settings\Page\PageNoApiKey; use Mollie\WooCommerce\Settings\Page\PagePaymentMethods; use Mollie\WooCommerce\Shared\Data; +use Psr\Container\ContainerInterface; use WC_Admin_Settings; use WC_Settings_Page; @@ -22,6 +23,7 @@ class MollieSettingsPage extends WC_Settings_Page protected array $paymentMethods; protected bool $isTestModeEnabled; protected Data $dataHelper; + protected ContainerInterface $container; public function __construct( Settings $settings, @@ -30,7 +32,8 @@ public function __construct( array $mollieGateways, array $paymentMethods, bool $isTestModeEnabled, - Data $dataHelper + Data $dataHelper, + ContainerInterface $container ) { $this->id = 'mollie_settings'; @@ -42,6 +45,7 @@ public function __construct( $this->isTestModeEnabled = $isTestModeEnabled; $this->dataHelper = $dataHelper; $this->paymentMethods = $paymentMethods; + $this->container = $container; $this->registerContentFieldType(); $this->outputSections(); parent::__construct(); @@ -128,7 +132,8 @@ public function get_settings($currentSection = '') $this->isTestModeEnabled, $this->mollieGateways, $this->paymentMethods, - $this->dataHelper + $this->dataHelper, + $this->container ); if ($page::slug() === $defaultSection) { $mollieSettings = $this->hideKeysIntoStars($page->settings()); diff --git a/src/Settings/Page/AbstractPage.php b/src/Settings/Page/AbstractPage.php index 86ce3362..13835d0d 100644 --- a/src/Settings/Page/AbstractPage.php +++ b/src/Settings/Page/AbstractPage.php @@ -7,6 +7,7 @@ use Mollie\WooCommerce\Settings\Page\Section\AbstractSection; use Mollie\WooCommerce\Settings\Settings; use Mollie\WooCommerce\Shared\Data; +use Psr\Container\ContainerInterface; abstract class AbstractPage { @@ -19,6 +20,7 @@ abstract class AbstractPage protected array $mollieGateways; protected array $paymentMethods; protected Data $dataHelper; + protected ContainerInterface $container; public function __construct( Settings $settings, @@ -29,7 +31,8 @@ public function __construct( bool $testModeEnabled, array $mollieGateways, array $paymentMethods, - Data $dataHelper + Data $dataHelper, + ContainerInterface $container ) { $this->settings = $settings; @@ -41,6 +44,7 @@ public function __construct( $this->mollieGateways = $mollieGateways; $this->paymentMethods = $paymentMethods; $this->dataHelper = $dataHelper; + $this->container = $container; } abstract public static function isTab(): bool; @@ -73,7 +77,8 @@ public function settings(): array $this->testModeEnabled, $this->mollieGateways, $this->paymentMethods, - $this->dataHelper + $this->dataHelper, + $this->container ); foreach ($section->config() as $field) { $settings[] = $field; diff --git a/src/Settings/Page/Section/AbstractSection.php b/src/Settings/Page/Section/AbstractSection.php index 2a47e23c..2d1c0687 100644 --- a/src/Settings/Page/Section/AbstractSection.php +++ b/src/Settings/Page/Section/AbstractSection.php @@ -6,6 +6,7 @@ use Mollie\WooCommerce\Settings\Settings; use Mollie\WooCommerce\Shared\Data; +use Psr\Container\ContainerInterface; abstract class AbstractSection { @@ -18,6 +19,7 @@ abstract class AbstractSection protected array $mollieGateways; protected array $paymentMethods; protected Data $dataHelper; + protected ContainerInterface $container; public function __construct( Settings $settings, @@ -28,7 +30,8 @@ public function __construct( bool $testModeEnabled, array $mollieGateways, array $paymentMethods, - Data $dataHelper + Data $dataHelper, + ContainerInterface $container ) { $this->settings = $settings; @@ -40,6 +43,7 @@ public function __construct( $this->mollieGateways = $mollieGateways; $this->paymentMethods = $paymentMethods; $this->dataHelper = $dataHelper; + $this->container = $container; } abstract public function config(): array; diff --git a/src/Settings/Page/Section/PaymentMethods.php b/src/Settings/Page/Section/PaymentMethods.php index 11fc8f67..c69ba1d2 100644 --- a/src/Settings/Page/Section/PaymentMethods.php +++ b/src/Settings/Page/Section/PaymentMethods.php @@ -41,13 +41,13 @@ public function renderGateways(): string 'mollie-payments-for-woocommerce' ); $descriptionActivePaymentMethods = __( - 'These payment methods are active in your Mollie profile. + 'These payment methods are active in your Mollie profile. You can enable these payment methods in their settings to make them available for your customers.', 'mollie-payments-for-woocommerce' ); $titleInactivePaymentMethods = __('Inactive Payment Methods', 'mollie-payments-for-woocommerce'); $descriptionInactivePaymentMethods = __( - 'These payment methods are available in your Mollie profile but are + 'These payment methods are available in your Mollie profile but are not currently active. Activate them to offer more payment options to your customers.', 'mollie-payments-for-woocommerce' ); @@ -228,12 +228,14 @@ protected function paymentGatewayButton(AbstractPaymentMethod $paymentMethod, $e esc_html(__('Activate Payment Method', 'mollie-payments-for-woocommerce')) . ''; } + $iconProvider = $paymentMethod->paymentMethodIconProvider($this->container); + $icon = $iconProvider->provideIcons()[0]; ob_start(); ?>
- getIconUrl(); // WPCS: XSS ok.?> - title());?> + src(); // WPCS: XSS ok.?> + title($this->container));?>
diff --git a/src/Settings/SettingsModule.php b/src/Settings/SettingsModule.php index 2562699c..ae4888bc 100644 --- a/src/Settings/SettingsModule.php +++ b/src/Settings/SettingsModule.php @@ -148,7 +148,14 @@ function () use ($optionName, $defaultAdvancedOptions, $defaultComponentsOptions $gateways = $container->get('__deprecated.gateway_helpers'); $isSDDGatewayEnabled = $container->get('gateway.isSDDGatewayEnabled'); - $this->initMollieSettingsPage($isSDDGatewayEnabled, $gateways, $pluginPath, $pluginUrl, $paymentMethods); + $this->initMollieSettingsPage( + $isSDDGatewayEnabled, + $gateways, + $pluginPath, + $pluginUrl, + $paymentMethods, + $container + ); add_action( 'woocommerce_admin_settings_sanitize_option', [$this->settingsHelper, 'updateMerchantIdOnApiKeyChanges'], @@ -250,9 +257,10 @@ public function maybeSaveDefaultSettings($optionName, $testOption, $defaultOptio * @param $pluginPath * @param $pluginUrl * @param $paymentMethods + * @param $container * @return void */ - protected function initMollieSettingsPage($isSDDGatewayEnabled, $gateways, $pluginPath, $pluginUrl, $paymentMethods): void + protected function initMollieSettingsPage($isSDDGatewayEnabled, $gateways, $pluginPath, $pluginUrl, $paymentMethods, $container): void { if (!$isSDDGatewayEnabled) { //remove directdebit gateway from gateways list @@ -260,7 +268,7 @@ protected function initMollieSettingsPage($isSDDGatewayEnabled, $gateways, $plug } add_filter( 'woocommerce_get_settings_pages', - function ($settings) use ($pluginPath, $pluginUrl, $gateways, $paymentMethods) { + function ($settings) use ($pluginPath, $pluginUrl, $gateways, $paymentMethods, $container) { $settings[] = new MollieSettingsPage( $this->settingsHelper, $pluginPath, @@ -268,7 +276,8 @@ function ($settings) use ($pluginPath, $pluginUrl, $gateways, $paymentMethods) { $gateways, $paymentMethods, $this->isTestModeEnabled, - $this->dataHelper + $this->dataHelper, + $container ); return $settings;