CoreFiles by mySites.guru
ModuleDispatcher.php57 lines, 1,389 bytes, from Joomla_4.2.2-Stable-Full_Package.zip
Raw History Compare with 4.2.1
md5
4b8ef9db0b033cb8edc5eb6581563ed1
sha1
4a2fda87e81f54b5a427c28ee507662d2b221a0b
sha256
41ce0ab1a49d88eb0df16ae9b2b6cd315c702007bbe52b850dd19ec4b839a4d4
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

namespace Joomla\CMS\Dispatcher;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * 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 (!is_file($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 27 releases, Joomla 4.2.1 to 4.3.1. See them all, or every version of this file.