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.2][Events] Use event classes for System plugins #43637

Open
wants to merge 19 commits into
base: 5.2-dev
Choose a base branch
from
Prev Previous commit
Next Next commit
system Accessibility
  • Loading branch information
Fedik committed Jun 8, 2024
commit faa78e524e21314d074b811ce964e1ce8b14bacb
14 changes: 8 additions & 6 deletions plugins/system/accessibility/src/Extension/Accessibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Joomla\Plugin\System\Accessibility\Extension;

use Joomla\CMS\Event\Application\BeforeCompileHeadEvent;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Event\SubscriberInterface;

Expand Down Expand Up @@ -45,34 +46,35 @@ public static function getSubscribedEvents(): array
*
* @since 4.0.0
*/
public function onBeforeCompileHead()
public function onBeforeCompileHead(BeforeCompileHeadEvent $event): void
{
$section = $this->params->get('section', 'administrator');
$app = $event->getApplication();

if ($section !== 'both' && $this->getApplication()->isClient($section) !== true) {
if ($section !== 'both' && $app->isClient($section) !== true) {
return;
}

// Get the document object.
$document = $this->getApplication()->getDocument();
$document = $event->getDocument();

if ($document->getType() !== 'html') {
return;
}

// Are we in a modal?
if ($this->getApplication()->getInput()->get('tmpl', '', 'cmd') === 'component') {
if ($app->getInput()->get('tmpl', '', 'cmd') === 'component') {
return;
}

// Load language file.
$this->loadLanguage();

// Determine if it is an LTR or RTL language
$direction = $this->getApplication()->getLanguage()->isRtl() ? 'right' : 'left';
$direction = $app->getLanguage()->isRtl() ? 'right' : 'left';

// Detect the current active language
$lang = $this->getApplication()->getLanguage()->getTag();
$lang = $app->getLanguage()->getTag();

/**
* Add strings for translations in Javascript.
Expand Down