Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Request.php

function Request::getRequestFormat

Gets the request format.

Here is the process to determine the format:

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

See also

getPreferredFormat

2 calls to Request::getRequestFormat()
Request::duplicate in vendor/symfony/http-foundation/Request.php
Clones a request and overrides some of its parameters.
Request::getPreferredFormat in vendor/symfony/http-foundation/Request.php
Gets the preferred format for the response by inspecting, in the following order:

File

vendor/symfony/http-foundation/Request.php, line 1276

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function getRequestFormat(?string $default = 'html') : ?string {
    $this->format ??= $this->attributes
        ->get('_format');
    return $this->format ?? $default;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal