diff --git a/composer.json b/composer.json index 4ccb424..7d414c8 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "by/guest-entries-notification", "description": "A plugin to get notification when an entry is created.", "type": "craft-plugin", - "version": "1.0.2", + "version": "2.0.0", "keywords": [ "craft", "cms", @@ -22,8 +22,8 @@ } ], "require": { - "craftcms/cms": "^3.0.0", - "craftcms/guest-entries": "^2.1.3" + "craftcms/cms": "^4.0.0", + "craftcms/guest-entries": "^3.0.0" }, "autoload": { "psr-4": { diff --git a/src/GuestEntriesNotification.php b/src/GuestEntriesNotification.php index 3d051b2..68fb639 100644 --- a/src/GuestEntriesNotification.php +++ b/src/GuestEntriesNotification.php @@ -1,6 +1,6 @@ systemSettings->getSettings('email'); + $prohectConfig = Craft::$app->getProjectConfig(); + $settings = $prohectConfig->get('email'); $pluginSettings = GuestEntriesNotification::$plugin->getSettings(); if(isset($pluginSettings->emailTo) and !empty($pluginSettings->emailTo)){ diff --git a/src/templates/settings.twig b/src/templates/settings.twig index 115f3e8..e3cb72f 100644 --- a/src/templates/settings.twig +++ b/src/templates/settings.twig @@ -1,7 +1,7 @@ {# @var craft \craft\web\twig\variables\CraftVariable #} {# /** - * Guest Entries Notification plugin for Craft CMS 3.x + * Guest Entries Notification plugin for Craft CMS 4.x * * Guest Entries Notification Settings.twig * @@ -9,22 +9,22 @@ * @copyright Copyright (c) 2018 Bhashkar Yadav * @link https://360adaptive.com * @package GuestEntriesNotification - * @since 1.0.0 + * @since 2.0.0 */ #} {% import "_includes/forms" as forms %} -{% set systemSettings = craft.systemSettings.email %} - -{% set defaultEmail = systemSettings.fromEmail %} +{% set prohectConfig = craft.app.getProjectConfig() %} +{% set emailSettings = prohectConfig.get('email') %} {{ forms.textField({ label: 'From Email', instructions: 'Enter the Email that will send the Notification Emails.', id: 'fromEmail', name: 'fromEmail', - value: settings['fromEmail']}) + value: settings['fromEmail'] ? settings['fromEmail'] : emailSettings.fromEmail + }) }} {{ forms.textField({ @@ -32,7 +32,7 @@ instructions: 'Enter the Name that will send the Notification Emails.', id: 'fromName', name: 'fromName', - value: settings['fromName']}) + value: settings['fromName'] ? settings['fromName'] : emailSettings.fromEmail}) }} {{ forms.textField({ diff --git a/src/translations/en/guest-entries-notification.php b/src/translations/en/guest-entries-notification.php index 44b7c4a..3dc9a10 100644 --- a/src/translations/en/guest-entries-notification.php +++ b/src/translations/en/guest-entries-notification.php @@ -1,6 +1,6 @@ 'Guest Entries Notification plugin loaded',