diff --git a/src/administrator/components/com_weblinks/script.php b/src/administrator/components/com_weblinks/script.php
index 141543d..8a00065 100644
--- a/src/administrator/components/com_weblinks/script.php
+++ b/src/administrator/components/com_weblinks/script.php
@@ -51,6 +51,7 @@ class Com_WeblinksInstallerScript
'/modules/mod_weblinks/mod_weblinks.php',
'/plugins/search/weblinks/weblinks.php',
'/plugins/finder/weblinks/weblinks.php',
+ '/plugins/editors-xtd/weblink/weblink.php',
];
$folders = [
diff --git a/src/plugins/editors-xtd/services/provider.php b/src/plugins/editors-xtd/services/provider.php
new file mode 100644
index 0000000..418d626
--- /dev/null
+++ b/src/plugins/editors-xtd/services/provider.php
@@ -0,0 +1,47 @@
+
+ * @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\Weblink\Extension\Weblink;
+
+return new class () implements ServiceProviderInterface {
+ /**
+ * Registers the service provider with a DI container.
+ *
+ * @param Container $container The DI container.
+ *
+ * @return void
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function register(Container $container)
+ {
+ $container->set(
+ PluginInterface::class,
+ function (Container $container) {
+ $app = Factory::getApplication();
+ $dispatcher = $container->get(DispatcherInterface::class);
+
+ return new Weblink(
+ $dispatcher,
+ (array) PluginHelper::getPlugin('editors-xtd', 'weblink'),
+ $app
+ );
+ }
+ );
+ }
+};
diff --git a/src/plugins/editors-xtd/weblink/weblink.php b/src/plugins/editors-xtd/src/Extension/Weblink.php
similarity index 80%
rename from src/plugins/editors-xtd/weblink/weblink.php
rename to src/plugins/editors-xtd/src/Extension/Weblink.php
index 2d6f54c..de0ce28 100644
--- a/src/plugins/editors-xtd/weblink/weblink.php
+++ b/src/plugins/editors-xtd/src/Extension/Weblink.php
@@ -7,28 +7,26 @@
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
+namespace Joomla\Plugin\EditorsXtd\Weblink\Extension;
+
defined('_JEXEC') or die;
+use Joomla\CMS\Application\CMSApplicationInterface;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Object\CMSObject;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Session\Session;
+use Joomla\Database\DatabaseAwareTrait;
+use Joomla\Database\DatabaseInterface;
+use Joomla\Event\DispatcherInterface;
/**
* Editor Web Link button
*
* @since __DEPLOY_VERSION__
*/
-class PlgButtonWeblink extends CMSPlugin
+final class Weblink extends CMSPlugin
{
- /**
- * Application object
- *
- * @var \Joomla\CMS\Application\CMSApplicationInterface
- * @since 4.0.0
- */
- protected $app;
-
/**
* Load the language file on instantiation.
*
@@ -37,18 +35,32 @@ class PlgButtonWeblink extends CMSPlugin
*/
protected $autoloadLanguage = true;
+ /**
+ * Constructor
+ *
+ * @param DispatcherInterface $dispatcher
+ * @param array $config
+ * @param DatabaseInterface $database
+ */
+ public function __construct(DispatcherInterface $dispatcher, array $config, CMSApplicationInterface $application)
+ {
+ parent::__construct($dispatcher, $config);
+
+ $this->setApplication($application);
+ }
+
/**
* Display the button
*
* @param string $name The name of the button to add
*
- * @return JObject The button options as JObject
+ * @return CMSObject The button options as JObject
*
* @since __DEPLOY_VERSION__
*/
public function onDisplay($name)
{
- $user = $this->app->getIdentity();
+ $user = $this->getApplication()->getIdentity();
if ($user->authorise('core.create', 'com_weblinks')
|| $user->authorise('core.edit', 'com_weblinks')
diff --git a/src/plugins/editors-xtd/weblink/weblink.xml b/src/plugins/editors-xtd/weblink/weblink.xml
index f1b2f37..9e11413 100644
--- a/src/plugins/editors-xtd/weblink/weblink.xml
+++ b/src/plugins/editors-xtd/weblink/weblink.xml
@@ -9,6 +9,7 @@
www.joomla.org
##VERSION##
PLG_EDITORS-XTD_WEBLINK_XML_DESCRIPTION
+ Joomla\Plugin\EditorsXtd\Weblink
##FILES##