function 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 65

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.