You are here

public function VersionNegotiator::addVersionNegotiator in JSON:API 8.2

Adds a version negotiator.

Parameters

\Drupal\jsonapi\Revisions\VersionNegotiatorInterface $version_negotiator: The version negotiator.

string $negotiator_name: The name of the negotiation strategy used by the version negotiator.

File

src/Revisions/VersionNegotiator.php, line 45

Class

VersionNegotiator
Provides a version negotiator manager.

Namespace

Drupal\jsonapi\Revisions

Code

public function addVersionNegotiator(VersionNegotiatorInterface $version_negotiator, $negotiator_name) {
  assert(strpos(get_class($version_negotiator), 'Drupal\\jsonapi\\') === 0, 'Version negotiators are not a public API.');
  $this->negotiators[$negotiator_name] = $version_negotiator;
}