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(); ?>