function VersionNegotiator::addVersionNegotiator

Same name in other branches
  1. 9 core/modules/jsonapi/src/Revisions/VersionNegotiator.php \Drupal\jsonapi\Revisions\VersionNegotiator::addVersionNegotiator()
  2. 8.9.x core/modules/jsonapi/src/Revisions/VersionNegotiator.php \Drupal\jsonapi\Revisions\VersionNegotiator::addVersionNegotiator()
  3. 11.x 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(str_starts_with(get_class($version_negotiator), 'Drupal\\jsonapi\\'), 'Version negotiators are not a public API.');
    $this->negotiators[$negotiator_name] = $version_negotiator;
}

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