- md5
- b7064ff89e1f3e5f6251d8136040a6ba
- sha1
- 392eeb46e8cc75a15b44c2fb0c08e9911d672cdd
- sha256
- cdf10106adc4e30abdc7bcf98f27aedd80785b43c63da59d9a4efd599ef6663d
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
<?php
/**
* @package Joomla.Plugin
* @subpackage System.skipto
*
* @copyright (C) 2019 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\Application\CMSApplicationInterface;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
/**
* Skipto plugin to add accessible keyboard navigation to the site and administrator templates.
*
* @since 4.0.0
*/
class PlgSystemSkipto extends CMSPlugin
{
/**
* Application object.
*
* @var CMSApplicationInterface
* @since 4.0.0
*/
protected $app;
/**
* Add the CSS and JavaScript for the skipto navigation menu.
*
* @return void
*
* @since 4.0.0
*/
public function onAfterDispatch()
{
$section = $this->params->get('section', 'administrator');
if ($section !== 'both' && $this->app->isClient($section) !== true)
{
return;
}
// Get the document object.
$document = $this->app->getDocument();
if ($document->getType() !== 'html')
{
return;
}
// Load language file.
$this->loadLanguage();
// Add strings for translations in JavaScript.
$document->addScriptOptions(
'skipto-settings',
[
'settings' => [
'skipTo' => [
'buttonDivRole' => 'navigation',
'buttonDivLabel' => Text::_('PLG_SYSTEM_SKIPTO_SKIP_TO_KEYBOARD'),
'buttonLabel' => Text::_('PLG_SYSTEM_SKIPTO_SKIP_TO'),
'buttonDivTitle' => '',
'menuLabel' => Text::_('PLG_SYSTEM_SKIPTO_SKIP_TO_AND_PAGE_OUTLINE'),
'landmarksLabel' => Text::_('PLG_SYSTEM_SKIPTO_SKIP_TO'),
'headingsLabel' => Text::_('PLG_SYSTEM_SKIPTO_PAGE_OUTLINE'),
// The following string begins with a space
'contentLabel' => ' ' . Text::_('PLG_SYSTEM_SKIPTO_CONTENT'),
]
]
]
);
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $document->getWebAssetManager();
$wa->useStyle('skipto')
->useScript('skipto.dropmenu')
->useScript('skipto')
->addInlineScript(
'document.addEventListener(\'DOMContentLoaded\', function() {'
. 'window.SkipToConfig = Joomla.getOptions(\'skipto-settings\');'
. 'window.skipToMenuInit();});',
[],
['type' => 'module'],
['skipto']
);
}
}
No other release has this exact content. See every version of this file.