Chris@0: get('link_domain'); Chris@0: $uri = str_replace($base, 'http://mymodule.domain', $uri); Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Alter the REST relation URI. Chris@0: * Chris@0: * @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. Use Chris@0: * hook_serialization_relation_uri_alter() instead. This exists solely for BC. Chris@0: * Chris@0: * @see https://www.drupal.org/node/2830467 Chris@0: * Chris@0: * Modules may wish to alter the relation URI generated for a resource based on Chris@0: * the context of the serializer/normalizer operation. Chris@0: * Chris@0: * @param string $uri Chris@0: * The URI to alter. Chris@0: * @param array $context Chris@0: * The context from the serializer/normalizer operation. Chris@0: * Chris@0: * @see \Symfony\Component\Serializer\SerializerInterface::serialize() Chris@0: * @see \Symfony\Component\Serializer\SerializerInterface::deserialize() Chris@0: * @see \Symfony\Component\Serializer\NormalizerInterface::normalize() Chris@0: * @see \Symfony\Component\Serializer\DenormalizerInterface::denormalize() Chris@0: */ Chris@0: function hook_rest_relation_uri_alter(&$uri, $context = []) { Chris@0: if ($context['mymodule'] == TRUE) { Chris@0: $base = \Drupal::config('serialization.settings')->get('link_domain'); Chris@0: $uri = str_replace($base, 'http://mymodule.domain', $uri); Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * @} End of "addtogroup hooks". Chris@0: */