getDefaultFormat example

/** * Provides a route filter, which filters by the request format. */
class RequestFormatRouteFilter implements FilterInterface {

  /** * {@inheritdoc} */
  public function filter(RouteCollection $collection, Request $request) {
    // Determine the request format.     $default_format = static::getDefaultFormat($collection);
    // If the request does not specify a format then use the default.     if (is_null($request->getRequestFormat(NULL))) {
      $format = $default_format;
      $request->setRequestFormat($default_format);
    }
    else {
      $format = $request->getRequestFormat($default_format);
    }

    $routes_with_requirement = [];
    $routes_without_requirement = [];
    
Home | Imprint | This part of the site doesn't use cookies.