- md5
- b6a05b4e3ea8159c101a2c56c1431f91
- sha1
- a447ef09d3fed82c9919e91665e5a0c35130327e
- sha256
- 6f080332350e981ea264643ec88616a3e60de71b67b1a5893e99476873970238
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
<?php
/**
* @package Joomla.Site
* @subpackage com_modules
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Modules\Site\Dispatcher;
\defined('_JEXEC') or die;
use Joomla\CMS\Access\Exception\NotAllowed;
use Joomla\CMS\Dispatcher\ComponentDispatcher;
use Joomla\CMS\MVC\Controller\BaseController;
/**
* ComponentDispatcher class for com_modules
*
* @since 4.0.0
*/
class Dispatcher extends ComponentDispatcher
{
/**
* Load the language
*
* @since 4.0.0
*
* @return void
*/
protected function loadLanguage()
{
$this->app->getLanguage()->load('com_modules', JPATH_ADMINISTRATOR);
}
/**
* Dispatch a controller task. Redirecting the user if appropriate.
*
* @return void
*
* @since 4.0.0
*/
public function checkAccess()
{
parent::checkAccess();
if ($this->input->get('view') === 'modules'
&& $this->input->get('layout') === 'modal'
&& !$this->app->getIdentity()->authorise('core.create', 'com_modules'))
{
throw new NotAllowed;
}
}
/**
* Get a controller from the component
*
* @param string $name Controller name
* @param string $client Optional client (like Administrator, Site etc.)
* @param array $config Optional controller config
*
* @return \Joomla\CMS\MVC\Controller\BaseController
*
* @since 4.0.0
*/
public function getController(string $name, string $client = '', array $config = array()): BaseController
{
if ($this->input->get('task') === 'orderPosition')
{
$config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
$client = 'Administrator';
}
return parent::getController($name, $client, $config);
}
}
The same content is in 51 releases, Joomla 4.0.0-beta6 to 4.2.0-beta2. See them all, or every version of this file.