Skip to content

Commit

Permalink
Simplify code (#25687)
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkyKZ authored and wilsonge committed Jul 23, 2019
1 parent d029939 commit 9ac19fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions plugins/system/skipto/skipto.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

defined('_JEXEC') or die;

use Joomla\CMS\Application\CMSApplicationInterface;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
Expand All @@ -23,7 +24,7 @@ class PlgSystemSkipto extends CMSPlugin
/**
* Application object.
*
* @var \Joomla\CMS\Application\CMSApplication
* @var CMSApplicationInterface
* @since 4.0.0
*/
protected $app;
Expand All @@ -37,9 +38,9 @@ class PlgSystemSkipto extends CMSPlugin
*/
public function onAfterDispatch()
{
$section = $this->params->get('section_skipto', 2);
$section = $this->params->get('section', 'administrator');

if ($section !== 3 && ($this->app->isClient('administrator') && $section !== 2 || $this->app->isClient('site') && $section !== 1))
if ($section !== 'both' && $this->app->isClient($section) !== true)
{
return;
}
Expand Down
12 changes: 6 additions & 6 deletions plugins/system/skipto/skipto.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
<fields name="params">
<fieldset name="basic">
<field
name="section_skipto"
name="section"
type="list"
label="PLG_SYSTEM_SKIPTO_SECTION"
default="2"
filter="integer"
default="administrator"
validate="options"
>
<option value="1">PLG_SYSTEM_SKIPTO_SECTION_SITE</option>
<option value="2">PLG_SYSTEM_SKIPTO_SECTION_ADMIN</option>
<option value="3">PLG_SYSTEM_SKIPTO_SECTION_BOTH</option>
<option value="site">PLG_SYSTEM_SKIPTO_SECTION_SITE</option>
<option value="administrator">PLG_SYSTEM_SKIPTO_SECTION_ADMIN</option>
<option value="both">PLG_SYSTEM_SKIPTO_SECTION_BOTH</option>
</field>
</fieldset>
</fields>
Expand Down

0 comments on commit 9ac19fa

Please sign in to comment.