CoreFiles by mySites.guru
dispatcher.php87 lines, 1,960 bytes, from Joomla_4.0.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha2
md5
38379d56a084be6d8dc985f19e7e718e
sha1
a8362b7c3b8b7da1c4caead8894f933118e83039
sha256
1d2a0dfe81b58944365a3cb931914a717c34f1d485397a2a7ebe56912b5e5fd6
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_modules
 *
 * @copyright   Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Dispatcher\Dispatcher;
use Joomla\CMS\MVC\Controller\BaseController;

/**
 * Dispatcher class for com_content
 *
 * @since  4.0.0
 */
class ModulesDispatcher extends Dispatcher
{
	/**
	 * The extension namespace
	 *
	 * @var    string
	 *
	 * @since  4.0.0
	 */
	protected $namespace = 'Joomla\\Component\\Modules';

	/**
	 * Load the language
	 *
	 * @since   4.0.0
	 *
	 * @return  void
	 */
	protected function loadLanguage()
	{
		$this->app->getLanguage()->load('joomla', JPATH_ADMINISTRATOR);
		$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 dispatch()
	{
		if ($this->input->get('view') === 'modules' && $this->input->get('layout') === 'modal')
		{
			if (!$this->app->getIdentity()->authorise('core.create', 'com_modules'))
			{
				$this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning');

				return;
			}
		}

		parent::dispatch();
	}

	/**
	 * 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);
	}
}

No other release has this exact content. See every version of this file.