CoreFiles by mySites.guru
ModuleDispatcher.php53 lines, 1,282 bytes, from Joomla_4.2.1-rc2-Release_Candidate-Full_Package.zip
Raw History Compare with 4.2.1-rc1
md5
1bdc04f830952280be31e924b0ae5e6a
sha1
252656f7a0087d0a318789d69ba2a4f5f45c3bb6
sha256
8169c3760f5709983bcf1da81cfe48475179ff94f69a5bb47215b4430685ce16
<?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;

/**
 * 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 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.