Back to ModuleDispatcher class

Method dispatch

public void
dispatch
()
Dispatches the dispatcher.
Returns
  • void
Since
  • 4.0.0

Method dispatch - Source code

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