kosoukhov/yii2-ckeditor-youtube-plugin

Yii2 Youtube embed plugin for CKEditor based on Youtube embed (https://github.com/fonini/ckeditor-youtube-plugin/releases/tag/v2.1.18)

1.0.0 2021-04-13 10:47 UTC

This package is auto-updated.

Last update: 2024-04-13 17:24:47 UTC


README

Yii2 YouTube embed plugin (as widget) for CKEditor based on YouTube embed

Yii2 Latest Stable Version Total Downloads Latest Unstable Version License

Based on YouTube embed https://github.com/fonini/ckeditor-youtube-plugin/releases/tag/v2.1.18

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require kosoukhov/yii2-ckeditor-youtube-plugin "^1.0"

or add

"kosoukhov/yii2-ckeditor-youtube-plugin": "^1.0"

to the require section of your composer.json file.

Usage example:

Once the widget is installed, use it in your code.

You must specify in the plugin dependencies the set of editor Asset to which you connect the plugin.

If you are using the https://github.com/2amigos/yii2-ckeditor-widget then an example code like this:

class SetUp implements BootstrapInterface
{
    public function bootstrap($app)
    {
        $container = Yii::$container;

        $container->set(YoutubeEmbed::class, ['depends' => ['dosamigos\ckeditor\CKEditorWidgetAsset']]);

        $container->set(CKEditor::class, [
            'preset' => 'standart',
            'clientOptions' => [
                    'extraPlugins' => $container->get(YoutubeEmbed::class)::getPluginName()
                ]            
        ]);
    }
}

If you are using the https://github.com/MihailDev/yii2-ckeditor then an example code like this:

class SetUp implements BootstrapInterface
{
    public function bootstrap($app)
    {
        $container = Yii::$container;

        $container->set(YoutubeEmbed::class, ['depends' => ['mihaildev\ckeditor\Assets']]);

        $container->set(CKEditor::class, [
            'editorOptions' => [
                    'extraPlugins' => $container->get(YoutubeEmbed::class)::getPluginName()
                ]
        ]);
    }
}