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

Breadcrumb

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

function Request::setFormat

Associates a format with mime types.

Parameters

string|string[] $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type):

File

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

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function setFormat(?string $format, string|array $mimeTypes) : void {
    if (null === static::$formats) {
        static::initializeFormats();
    }
    static::$formats[$format] = \is_array($mimeTypes) ? $mimeTypes : [
        $mimeTypes,
    ];
}

API Navigation

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