public function Request::getRequestFormat

Gets the request format.

Here is the process to determine the format:

  • format defined by the user (with setRequestFormat())
  • _format request parameter
  • $default

@api

Parameters

string $default The default format:

Return value

string The request format

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php, line 1013

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function getRequestFormat($default = 'html') {
  if (null === $this->format) {
    $this->format = $this
      ->get('_format', $default);
  }
  return $this->format;
}