<?php /** * @package JMP Modal & Popup Button * @version 1.0.0 * @copyright Copyright (C) 2021 JoomHelper.com * @license GNU 2 or later * @author JoomHelper */ // No direct access. defined('_JEXEC') or die; class plgButtonJMPModal extends JPlugin { public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); } public function onDisplay($name) { $app = JFactory::getApplication(); $doc = JFactory::getDocument(); $js = " function insertModalCode(editor) { jInsertEditorText('<div>{modal}<p>Insert your content here</p>{/modal}</div>', editor); } "; $doc->addScriptDeclaration($js); $button = new JObject; $button->set('modal', false); $button->set('onclick', 'insertModalCode(\''.$name.'\');return false;'); $button->set('text', 'JMP Modal & Popup'); $button->set('name', 'file-add'); $button->set('link', '#'); return $button; } }