- md5
- a3e6d9b70b0cf5b166531bb297bde9f3
- sha1
- f871219250645bad085c75c381ba5ba438d850e4
- sha256
- a00f3d1eb94fb25cd38bad2d8b8a5f93e8a832d2b00ab989ea0f5e8b84b3caff
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
<?php
/**
* @package Joomla.Plugin
* @subpackage System.skipto
*
* @copyright (C) 2020 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 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;
}
// Are we in a modal?
if ($this->app->input->get('tmpl', '', 'cmd') === 'component')
{
return;
}
// Load language file.
$this->loadLanguage();
// Add plugin settings and strings for translations in JavaScript.
$document->addScriptOptions(
'skipto-settings',
[
'settings' => [
'skipTo' => [
// Feature switches
'enableActions' => false,
'enableHeadingLevelShortcuts' => false,
// Customization of button and menu
'accesskey' => '9',
'displayOption' => 'popup',
// Button labels and messages
'accesskeyNotSupported' => Text::_('PLG_SYSTEM_SKIPTO_ACCESS_KEY_NOT_SUPPORTED'),
'buttonTitle' => Text::_('PLG_SYSTEM_SKIPTO_TITLE'),
'buttonTitleWithAccesskey' => Text::_('PLG_SYSTEM_SKIPTO_TITLE_WITH_ACCCESS_KEY'),
'buttonLabel' => Text::_('PLG_SYSTEM_SKIPTO_SKIP_TO'),
// Menu labels and messages
'landmarkGroupLabel' => Text::_('PLG_SYSTEM_SKIPTO_LANDMARK'),
'headingGroupLabel' => Text::_('PLG_SYSTEM_SKIPTO_HEADING'),
'mofnGroupLabel' => Text::_('PLG_SYSTEM_SKIPTO_HEADING_MOFN'),
'headingLevelLabel' => Text::_('PLG_SYSTEM_SKIPTO_HEADING_LEVEL'),
'mainLabel' => Text::_('PLG_SYSTEM_SKIPTO_LANDMARK_MAIN'),
'searchLabel' => Text::_('PLG_SYSTEM_SKIPTO_LANDMARK_SEARCH'),
'navLabel' => Text::_('PLG_SYSTEM_SKIPTO_LANDMARK_NAV'),
'regionLabel' => Text::_('PLG_SYSTEM_SKIPTO_LANDMARK_REGION'),
'asideLabel' => Text::_('PLG_SYSTEM_SKIPTO_LANDMARK_ASIDE'),
'footerLabel' => Text::_('PLG_SYSTEM_SKIPTO_LANDMARK_FOOTER'),
'headerLabel' => Text::_('PLG_SYSTEM_SKIPTO_LANDMARK_HEADER'),
'formLabel' => Text::_('PLG_SYSTEM_SKIPTO_LANDMARK_FORM'),
'msgNoLandmarksFound' => Text::_('PLG_SYSTEM_SKIPTO_LANDMARK_NONE'),
'msgNoHeadingsFound' => Text::_('PLG_SYSTEM_SKIPTO_HEADING_NONE'),
// Selectors for landmark and headings sections
'headings' => 'h1, h2, h3',
'landmarks' => 'main, nav, search, aside, header, footer, form',
]
]
]
);
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $document->getWebAssetManager();
$wa->useScript('skipto');
}
}
No other release has this exact content. See every version of this file.