CoreFiles by mySites.guru
ModuleDispatcher.php59 lines, 1,171 bytes, from Joomla_4.0.0-beta1-Beta-Full_Package.zip
Raw History Compare with 3.9.0-beta4
md5
cff13ca68f21b4ee185a33c09ab7b7ea
sha1
dc35844fde74deea9d11a6ba54d1076d257ca48b
sha256
e1cc6080665313370b3e2067c0b7181f90a1cd2dd96b5405d7a85655f3fa9e49
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

namespace Joomla\CMS\Dispatcher;

\defined('_JEXEC') or die;

/**
 * Base class for a Joomla Module Dispatcher
 *
 * Executes the single entry file of a module.
 *
 * @since  4.0.0
 */
class ModuleDispatcher extends AbstractModuleDispatcher
{
	/**
	 * Dispatches the dispatcher.
	 *
	 * @return  void
	 *
	 * @since   4.0.0
	 */
	public function dispatch()
	{
		$path = JPATH_BASE . '/modules/' . $this->module->module . '/' . $this->module->module . '.php';

		if (!file_exists($path))
		{
			return;
		}

		$this->loadLanguage();

		// Execute the layout without the module context
		$loader = static function ($path, array $displayData)
		{
			// If $displayData doesn't exist in extracted data, unset the variable.
			if (!\array_key_exists('displayData', $displayData))
			{
				extract($displayData);
				unset($displayData);
			}
			else
			{
				extract($displayData);
			}

			include $path;
		};

		$loader($path, $this->getLayoutData());
	}
}

The same content is in 4 releases, Joomla 4.0.0-beta to 4.0.0-beta4. See them all, or every version of this file.