function NegotiationMiddleware::registerFormat

Same name in other branches
  1. 9 core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php \Drupal\Core\StackMiddleware\NegotiationMiddleware::registerFormat()
  2. 8.9.x core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php \Drupal\Core\StackMiddleware\NegotiationMiddleware::registerFormat()
  3. 11.x core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php \Drupal\Core\StackMiddleware\NegotiationMiddleware::registerFormat()

Registers a format for a given MIME type.

Parameters

string $format: The format.

string $mime_type: The MIME type.

Return value

$this

File

core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php, line 64

Class

NegotiationMiddleware
Provides a middleware to determine the content type upon the accept header.

Namespace

Drupal\Core\StackMiddleware

Code

public function registerFormat($format, $mime_type) {
    $this->formats[$format] = $mime_type;
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.