'Blog Video Extension', 'description' => 'Adds responsive video embedding features to the RainLab Blog module.', 'author' => 'Alexey Bobkov, Samuel Georges', 'icon' => 'icon-video-camera', 'homepage' => 'https://github.com/rainlab/blogvideo-plugin' ]; } /** * Register method, called when the plugin is first registered. */ public function register() { PostsController::extend(function($controller) { if (!in_array(BackendController::$action, ['create', 'update'])) return; $controller->addJs('/plugins/rainlab/blogvideo/assets/js/blog-video.js'); $controller->addCss('/plugins/rainlab/blogvideo/assets/css/blog-video.css'); }); /* * Register the video tag processing callback */ TagProcessor::instance()->registerCallback(function($input, $preview) { if (!$preview) return $input; $popup = file_get_contents(__DIR__.'/partials/popup.htm'); return preg_replace('|\([0-9]+)|m', ' Click to embed a video... '.$popup.' ', $input); }); } }