src/Field.php
public static function registerRedactorPlugin(string $plugin)
    {
        if (isset(self::$_registeredPlugins[$plugin])) {
            return;
        }

        $paths = self::redactorPluginPaths();

        foreach ($paths as $registeredPath) {
            foreach (["{$registeredPath}/{$plugin}", $registeredPath] as $path) {
                if (file_exists("{$path}/{$plugin}.js")) {
                    $view = Craft::$app->getView();
                    $baseUrl = Craft::$app->getAssetManager()->getPublishedUrl($path, true);
                    $view->registerJsFile("{$baseUrl}/{$plugin}.js", [
                        'depends' => RedactorAsset::class
                    ]);
                    // CSS file too?
                    if (file_exists("{$path}/{$plugin}.css")) {
                        $view->registerCssFile("{$baseUrl}/{$plugin}.css");
                    }
                    // Don't do this twice
                    self::$_registeredPlugins[$plugin] = true;
                    return;
                }
            }
        }

        throw new InvalidConfigException('Redactor plugin not found: '.$plugin);
    }
public static function registerRedactorPlugin(string $plugin)
    {
        if (isset(self::$_registeredPlugins[$plugin])) {
            return;
        }

        $paths = self::redactorPluginPaths();

        foreach ($paths as $registeredPath) {
            foreach (["{$registeredPath}/{$plugin}", $registeredPath] as $path) {
                if (file_exists("{$path}/{$plugin}.js")) {
                    $view = Craft::$app->getView();
                    $baseUrl = Craft::$app->getAssetManager()->getPublishedUrl($path, true);
                    $view->registerJsFile("{$baseUrl}/{$plugin}.js", [
                        'depends' => RedactorAsset::class
                    ]);
                    // CSS file too?
                    if (file_exists("{$path}/{$plugin}.css")) {
                        $view->registerCssFile("{$baseUrl}/{$plugin}.css");
                    }
                    // Don't do this twice
                    self::$_registeredPlugins[$plugin] = true;
                    return;
                }
            }
        }

        throw new InvalidConfigException('Redactor plugin not found: '.$plugin);
    }
public static function registerRedactorPlugin ( string $ plugin ) { if ( isset ( self :: $ _registeredPlugins [ $ plugin ] ) ) { return ; } $ paths = self :: redactorPluginPaths ( ) ; foreach ( $ paths as $ registeredPath ) { foreach ( [ "{$registeredPath}/{$plugin}" , $ registeredPath ] as $ path ) { if ( file_exists ( "{$path}/{$plugin}.js" ) ) { $ view = Craft :: $ app -> getView ( ) ; $ baseUrl = Craft :: $ app -> getAssetManager ( ) -> getPublishedUrl ( $ path , true ) ; $ view -> registerJsFile ( "{$baseUrl}/{$plugin}.js" , [ 'depends' => RedactorAsset :: class ] ) ; // CSS file too? if ( file_exists ( "{$path}/{$plugin}.css" ) ) { $ view -> registerCssFile ( "{$baseUrl}/{$plugin}.css" ) ; } // Don't do this twice self :: $ _registeredPlugins [ $ plugin ] = true ; return ; } } } throw new InvalidConfigException ( 'Redactor plugin not found: ' . $ plugin ) ; }
Registers a Redactor plugin's JS & CSS files.

@param string $plugin
@return void
@throws InvalidConfigException if the plugin can't be found
Registers a Redactor plugin s JS & CSS files .