Back to SiteRouter class

Method buildFormat

public void
buildFormat
(mixed &$router, mixed &$uri)
Build the format of the request
Parameters
  • \Joomla\CMS\Router\SiteRouter & $router Router object
  • \Joomla\CMS\Uri\Uri & $uri URI object to process
Returns
  • void
Since
  • 4.0.0
Class: SiteRouter
Project: Joomla

Method buildFormat - Source code

/**
 * Build the format of the request
 *
 * @param   SiteRouter  &$router  Router object
 * @param   Uri         &$uri     URI object to process
 *
 * @return  void
 *
 * @since   4.0.0
 */
public function buildFormat(&$router, &$uri)
{
    $route = $uri->getPath();
    // Identify format
    if (!(substr($route, -9) === 'index.php' || substr($route, -1) === '/') && ($format = $uri->getVar('format', 'html'))) {
        $route .= '.' . $format;
        $uri->setPath($route);
        $uri->delVar('format');
    }
}