protected static function LinkProviderManager::getContextType in JSON:API Hypermedia 8
Gets the context type.
Parameters
\Drupal\jsonapi\JsonApiResource\JsonApiDocumentTopLevel|\Drupal\jsonapi\JsonApiResource\ResourceObject|\Drupal\jsonapi\JsonApiResource\Relationship $context: The context object from which links should be generated.
Return value
string The context type.
1 call to LinkProviderManager::getContextType()
- LinkProviderManager::getApplicableDefinitions in src/
Plugin/ LinkProviderManager.php - Gets the link provider definitions applicable to the given context object.
File
- src/
Plugin/ LinkProviderManager.php, line 203
Class
- LinkProviderManager
- Manages discovery and instantiation of resourceFieldEnhancer plugins.
Namespace
Drupal\jsonapi_hypermedia\PluginCode
protected static function getContextType($context) {
foreach (static::$contextTypes as $type => $class) {
if ($context instanceof $class) {
$context_type = $type;
}
}
assert(isset($context_type));
return $context_type;
}