I'm trying to use Redactor as a dependency for a plugin I'm writing.
I need it to be installed before I run my Install.php
migration, because in the migration I'm creating a Redactor field.
Following this question I tried to listen to the AFTER_LOAD_PLUGINS Event:
use craft\services\Plugins;
use yii\base\Event;
use craft\redactor\Plugin as Redactor;
class Plugin extends \craft\base\Plugin
{
public function init()
{
parent::init();
Event::on(Plugins::class, Plugins::EVENT_AFTER_LOAD_PLUGINS, function () {
Redactor::getInstance()->install();
});
}
}
However Redactor::getInstance()
still returns null
.