You are here

public function VersionNegotiator::addVersionNegotiator in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/Revisions/VersionNegotiator.php \Drupal\jsonapi\Revisions\VersionNegotiator::addVersionNegotiator()
  2. 9 core/modules/jsonapi/src/Revisions/VersionNegotiator.php \Drupal\jsonapi\Revisions\VersionNegotiator::addVersionNegotiator()

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

core/modules/jsonapi/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;
}