Back to ApiApplication class

Method dispatch

public void
dispatch
(mixed $component = null)
Dispatch the application
Parameters
  • string $component The component which is being rendered.
Returns
  • void
Since
  • 4.0.0

Method dispatch - Source code

/**
 * Dispatch the application
 *
 * @param   string  $component  The component which is being rendered.
 *
 * @return  void
 *
 * @since   4.0.0
 */
public function dispatch($component = null)
{
    // Get the component if not set.
    if (!$component) {
        $component = $this->input->get('option', null);
    }
    // Load the document to the API
    $this->loadDocument();
    // Set up the params
    $document = Factory::getDocument();
    // Register the document object with Factory
    Factory::$document = $document;
    $contents = ComponentHelper::renderComponent($component);
    $document->setBuffer($contents, 'component');
    // Trigger the onAfterDispatch event.
    PluginHelper::importPlugin('system');
    $this->triggerEvent('onAfterDispatch');
}