first commit
This commit is contained in:
21
plugins/editors-xtd/module/module.xml
Normal file
21
plugins/editors-xtd/module/module.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="plugin" group="editors-xtd" method="upgrade">
|
||||
<name>plg_editors-xtd_module</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2015-10</creationDate>
|
||||
<copyright>(C) 2015 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.5.0</version>
|
||||
<description>PLG_MODULE_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Plugin\EditorsXtd\Module</namespace>
|
||||
<files>
|
||||
<folder plugin="module">services</folder>
|
||||
<folder>src</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_module.ini</language>
|
||||
<language tag="en-GB">language/en-GB/plg_editors-xtd_module.sys.ini</language>
|
||||
</languages>
|
||||
</extension>
|
||||
46
plugins/editors-xtd/module/services/provider.php
Normal file
46
plugins/editors-xtd/module/services/provider.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.article
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Extension\PluginInterface;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use Joomla\Event\DispatcherInterface;
|
||||
use Joomla\Plugin\EditorsXtd\Module\Extension\Module;
|
||||
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->set(
|
||||
PluginInterface::class,
|
||||
function (Container $container) {
|
||||
$plugin = new Module(
|
||||
$container->get(DispatcherInterface::class),
|
||||
(array) PluginHelper::getPlugin('editors-xtd', 'module')
|
||||
);
|
||||
$plugin->setApplication(Factory::getApplication());
|
||||
|
||||
return $plugin;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
76
plugins/editors-xtd/module/src/Extension/Module.php
Normal file
76
plugins/editors-xtd/module/src/Extension/Module.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Plugin
|
||||
* @subpackage Editors-xtd.module
|
||||
*
|
||||
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Plugin\EditorsXtd\Module\Extension;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Editor Module button
|
||||
*
|
||||
* @since 3.5
|
||||
*/
|
||||
final class Module extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.5
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Display the button
|
||||
*
|
||||
* @param string $name The name of the button to add
|
||||
*
|
||||
* @return CMSObject|void The button options as CMSObject
|
||||
*
|
||||
* @since 3.5
|
||||
*/
|
||||
public function onDisplay($name)
|
||||
{
|
||||
/*
|
||||
* Use the built-in element view to select the module.
|
||||
* Currently uses blank class.
|
||||
*/
|
||||
$user = $this->getApplication()->getIdentity();
|
||||
|
||||
if (
|
||||
$user->authorise('core.create', 'com_modules')
|
||||
|| $user->authorise('core.edit', 'com_modules')
|
||||
|| $user->authorise('core.edit.own', 'com_modules')
|
||||
) {
|
||||
$link = 'index.php?option=com_modules&view=modules&layout=modal&tmpl=component&'
|
||||
. Session::getFormToken() . '=1&editor=' . $name;
|
||||
|
||||
$button = new CMSObject();
|
||||
$button->action = 'modal';
|
||||
$button->link = $link;
|
||||
$button->text = Text::_('PLG_MODULE_BUTTON_MODULE');
|
||||
$button->name = $this->_type . '_' . $this->_name;
|
||||
$button->icon = 'cube';
|
||||
$button->iconSVG = '<svg viewBox="0 0 512 512" width="24" height="24"><path d="M239.1 6.3l-208 78c-18.7 7-31.1 '
|
||||
. '25-31.1 45v225.1c0 18.2 10.3 34.8 26.5 42.9l208 104c13.5 6.8 29.4 6.8 42.9 0l208-104c16.3-8.1 26.5-24.8 '
|
||||
. '26.5-42.9V129.3c0-20-12.4-37.9-31.1-44.9l-208-78C262 2.2 250 2.2 239.1 6.3zM256 68.4l192 72v1.1l-192 '
|
||||
. '78-192-78v-1.1l192-72zm32 356V275.5l160-65v133.9l-160 80z"></path></svg>';
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user