Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.0] Simplify event class usage #41855

Merged
merged 1 commit into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Joomla\CMS\Versioning\VersionableModelTrait;
use Joomla\CMS\Workflow\Workflow;
use Joomla\Component\Categories\Administrator\Helper\CategoriesHelper;
use Joomla\Component\Content\Administrator\Event\Model\FeatureEvent;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
use Joomla\Database\ParameterType;
use Joomla\Filter\OutputFilter;
Expand Down Expand Up @@ -845,7 +846,7 @@ public function featured($pks, $value = 0, $featuredUp = null, $featuredDown = n
AbstractEvent::create(
$this->event_before_change_featured,
[
'eventClass' => 'Joomla\Component\Content\Administrator\Event\Model\FeatureEvent',
'eventClass' => FeatureEvent::class,
'subject' => $this,
'extension' => $context,
'pks' => $pks,
Expand Down Expand Up @@ -950,7 +951,7 @@ public function featured($pks, $value = 0, $featuredUp = null, $featuredDown = n
AbstractEvent::create(
$this->event_after_change_featured,
[
'eventClass' => 'Joomla\Component\Content\Administrator\Event\Model\FeatureEvent',
'eventClass' => FeatureEvent::class,
'subject' => $this,
'extension' => $context,
'pks' => $pks,
Expand Down
5 changes: 3 additions & 2 deletions libraries/src/MVC/View/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Event\AbstractEvent;
use Joomla\CMS\Event\View\DisplayEvent;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
Expand Down Expand Up @@ -193,7 +194,7 @@ public function display($tpl = null)
AbstractEvent::create(
'onBeforeDisplay',
[
'eventClass' => 'Joomla\CMS\Event\View\DisplayEvent',
'eventClass' => DisplayEvent::class,
'subject' => $this,
'extension' => $context,
]
Expand All @@ -207,7 +208,7 @@ public function display($tpl = null)
AbstractEvent::create(
'onAfterDisplay',
[
'eventClass' => 'Joomla\CMS\Event\View\DisplayEvent',
'eventClass' => DisplayEvent::class,
'subject' => $this,
'extension' => $context,
'source' => $result,
Expand Down
3 changes: 2 additions & 1 deletion libraries/src/WebAsset/WebAssetRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace Joomla\CMS\WebAsset;

use Joomla\CMS\Event\AbstractEvent;
use Joomla\CMS\Event\WebAsset\WebAssetRegistryAssetChanged;
use Joomla\CMS\WebAsset\Exception\UnknownAssetException;
use Joomla\Event\Dispatcher as EventDispatcher;
use Joomla\Event\DispatcherAwareInterface;
Expand Down Expand Up @@ -432,7 +433,7 @@ protected function dispatchAssetChanged(string $type, WebAssetItemInterface $ass
$event = AbstractEvent::create(
'onWebAssetRegistryChangedAsset' . ucfirst($change),
[
'eventClass' => 'Joomla\\CMS\\Event\\WebAsset\\WebAssetRegistryAssetChanged',
'eventClass' => WebAssetRegistryAssetChanged::class,
'subject' => $this,
'assetType' => $type,
'asset' => $asset,
Expand Down
3 changes: 2 additions & 1 deletion libraries/src/Workflow/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Event\AbstractEvent;
use Joomla\CMS\Event\Workflow\WorkflowTransitionEvent;
use Joomla\CMS\Extension\ComponentInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
Expand Down Expand Up @@ -400,7 +401,7 @@ public function executeTransition(array $pks, int $transitionId): bool
AbstractEvent::create(
'onWorkflowAfterTransition',
[
'eventClass' => 'Joomla\CMS\Event\Workflow\WorkflowTransitionEvent',
'eventClass' => WorkflowTransitionEvent::class,
'subject' => $this,
'extension' => $this->extension,
'pks' => $pks,
Expand Down