Skip to content

Commit 7f7e485

Browse files
committed
[K7.1] Remove remaining deprecated calls of triggerevent with
onKunenaGetButtons
1 parent 1ebb863 commit 7f7e485

3 files changed

Lines changed: 37 additions & 4 deletions

File tree

src/site/src/Controller/Message/Item/Actions/MessageItemActionsDisplay.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616
\defined('_JEXEC') or die();
1717

1818
use Exception;
19+
use Joomla\CMS\Factory;
1920
use Joomla\CMS\Language\Text;
2021
use Joomla\CMS\Plugin\PluginHelper;
2122
use Joomla\CMS\Router\Route;
2223
use Joomla\CMS\Session\Session;
2324
use Joomla\CMS\Uri\Uri;
2425
use Joomla\Registry\Registry;
2526
use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay;
27+
use Kunena\Forum\Libraries\Event\KunenaGetButtons;
2628
use Kunena\Forum\Libraries\Factory\KunenaFactory;
2729
use Kunena\Forum\Libraries\Forum\Message\KunenaMessage;
2830
use Kunena\Forum\Libraries\Forum\Topic\KunenaTopic;
@@ -547,9 +549,16 @@ protected function before()
547549
}
548550
}
549551

552+
$dispatcher = Factory::getApplication()->getDispatcher();
550553
PluginHelper::importPlugin('kunena');
551554

552-
$this->app->triggerEvent('onKunenaGetButtons', ['message.action', $this->messageButtons, $this]);
555+
$dispatcher->dispatch(
556+
'onKunenaGetButtons',
557+
new KunenaGetButtons(
558+
'onKunenaGetButtons',
559+
['context' => 'message.action', 'buttons' => $this->messageButtons, 'object' => $this]
560+
)
561+
);
553562
}
554563

555564
/**

src/site/src/Controller/Topic/Item/Actions/TopicItemActionsDisplay.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
\defined('_JEXEC') or die();
1717

1818
use Exception;
19+
use Joomla\CMS\Factory;
1920
use Joomla\CMS\Language\Text;
2021
use Joomla\CMS\Plugin\PluginHelper;
2122
use Joomla\CMS\Session\Session;
2223
use Joomla\Registry\Registry;
2324
use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay;
25+
use Kunena\Forum\Libraries\Event\KunenaGetButtons;
2426
use Kunena\Forum\Libraries\Exception\KunenaExceptionAuthorise;
2527
use Kunena\Forum\Libraries\Factory\KunenaFactory;
2628
use Kunena\Forum\Libraries\Forum\Topic\KunenaTopic;
@@ -267,9 +269,16 @@ protected function before()
267269
}
268270
}
269271

272+
$dispatcher = Factory::getApplication()->getDispatcher();
270273
PluginHelper::importPlugin('kunena');
271274

272-
$this->app->triggerEvent('onKunenaGetButtons', ['topic.action', $this->topicButtons, $this]);
275+
$dispatcher->dispatch(
276+
'onKunenaGetButtons',
277+
new KunenaGetButtons(
278+
'onKunenaGetButtons',
279+
['context' => 'topic.action', 'buttons' => $this->topicButton, 'object' => $this]
280+
)
281+
);
273282
}
274283

275284
/**

src/site/src/View/Topic/HtmlView.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
use Kunena\Forum\Libraries\Controller\KunenaControllerDisplay;
3232
use Kunena\Forum\Libraries\Date\KunenaDate;
3333
use Kunena\Forum\Libraries\Event\KunenaDisplayEvent;
34+
use Kunena\Forum\Libraries\Event\KunenaGetButtons;
3435
use Kunena\Forum\Libraries\Event\KunenaPrepareEvent;
3536
use Kunena\Forum\Libraries\Factory\KunenaFactory;
3637
use Kunena\Forum\Libraries\Forum\Category\KunenaCategoryHelper;
@@ -785,9 +786,16 @@ public function getTopicActions()
785786
}
786787
}
787788

789+
$dispatcher = Factory::getApplication()->getDispatcher();
788790
PluginHelper::importPlugin('kunena');
789791

790-
Factory::getApplication()->triggerEvent('onKunenaGetButtons', ['topic.action', $this->topicButtons, $this]);
792+
$dispatcher->dispatch(
793+
'onKunenaGetButtons',
794+
new KunenaGetButtons(
795+
'onKunenaGetButtons',
796+
['context' => 'topic.action', 'buttons' => $this->topicButtons, 'object' => $this]
797+
)
798+
);
791799

792800
return (string) $this->loadTemplateFile('actions');
793801
}
@@ -861,9 +869,16 @@ public function getMessageActions()
861869
$this->message->isAuthorised('delete') ? $this->messageButtons->set('delete', $this->getButton(sprintf($task, 'delete'), 'delete', 'message', 'moderation')) : null;
862870
}
863871

872+
$dispatcher = Factory::getApplication()->getDispatcher();
864873
PluginHelper::importPlugin('kunena');
865874

866-
Factory::getApplication()->triggerEvent('onKunenaGetButtons', ['message.action', $this->messageButtons, $this]);
875+
$dispatcher->dispatch(
876+
'onKunenaGetButtons',
877+
new KunenaGetButtons(
878+
'onKunenaGetButtons',
879+
['context' => 'message.action', 'buttons' => $this->messageButtons, 'object' => $this]
880+
)
881+
);
867882

868883
return (string) $this->loadTemplateFile("message_actions");
869884
}

0 commit comments

Comments
 (0)