You are here

public function AuthenticationLinkProvider::getLinkRelationType in JSON:API Hypermedia 8

Gets the link relation type for the provided link.

Return value

string A link relation type name for the provided link.

Overrides LinkProviderBase::getLinkRelationType

1 call to AuthenticationLinkProvider::getLinkRelationType()
AuthenticationLinkProvider::getLink in examples/Plugin/jsonapi_hypermedia/LinkProvider/AuthenticationLinkProvider.php
Adds, alters or removes hyperlinks from a link collection.

File

examples/Plugin/jsonapi_hypermedia/LinkProvider/AuthenticationLinkProvider.php, line 60

Class

AuthenticationLinkProvider
Adds an `authenticate` link for unauthenticated requests.

Namespace

Drupal\jsonapi_hypermedia\Plugin\jsonapi_hypermedia\LinkProvider

Code

public function getLinkRelationType() {
  return $this->currentUser
    ->isAuthenticated() ? 'logout' : 'authenticate';
}