hook_rest_type_uri_alter(&$uri, $context = array())
Alter the REST type URI.
Modules may wish to alter the type URI generated for a resource based on the context of the serializer/normalizer operation.
string $uri: The URI to alter.
array $context: The context from the serializer/normalizer operation.
\Symfony\Component\Serializer\SerializerInterface::serialize()
\Symfony\Component\Serializer\SerializerInterface::deserialize()
\Symfony\Component\Serializer\NormalizerInterface::normalize()
\Symfony\Component\Serializer\DenormalizerInterface::denormalize()
function hook_rest_type_uri_alter(&$uri, $context = array()) { if ($context['mymodule'] == TRUE) { $base = \Drupal::config('rest.settings')->get('link_domain'); $uri = str_replace($base, 'http://mymodule.domain', $uri); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!rest!rest.api.php/function/hook_rest_type_uri_alter/8.1.x