I'm trying to follow along with the guide on creating custom notification events in a plugin found here: https://sprout.barrelstrengthdesign.com/docs/email/custom-notification-events.html#register-event
I used their example Manual class as my notification and now I'm trying to register it, however, I get an error of:
Class barrelstrength\sproutbase\app\email\services\NotificationEmailEvents' not found.
I checked and made sure that the sprout email is installed and enabled and also my plugin is installed and enabled.
Below is what is in my main plugin file:
namespace mycompany\plugin;
use myname\company\notifications\Manual as PluginManualNotification;
use barrelstrength\sproutbase\app\email\services\NotificationEmailEvents;
use barrelstrength\sproutbase\app\email\events\NotificationEmailEvent;
use Craft;
use craft\base\Plugin;
use craft\services\Plugins;
use craft\events\PluginEvent;
use yii\base\Event;
class MyPlugin extends Plugin
{
public static $plugin;
public $schemaVersion = '1.0.0';
public function init()
{
parent::init();
self::$plugin = $this;
Event::on(
Plugins::class,
Plugins::EVENT_AFTER_INSTALL_PLUGIN,
function (PluginEvent $event) {
if ($event->plugin === $this) {
// We were just installed.
}
}
);
Event::on(
NotificationEmailEvents::class,
NotificationEmailEvents::EVENT_REGISTER_EMAIL_EVENT_TYPES,
function (NotificationEmailEvent $event) {
$event->events[] = PluginManualNotification::class;
}
);
}
/* Create settings modal and other unrelated stuff */
}
Argument 1 passed to myPlugin\{closure}() must be an instance of barrelstrength\sproutbaseemail\base\NotificationEmailEvent, instance of barrelstrength\sproutbaseemail\events\NotificationEmailEvent givenwhich is strange because I am not usingbarrelstrength\sproutbaseemail\eventsanywhere in my plugin. – Mr.Smithyyy Dec 12 '19 at 14:14