1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- function hook_rest_resource_alter(&$definitions) {
- if (isset($definitions['entity:node'])) {
-
-
- $definitions['entity:node']['class'] = 'Drupal\mymodule\Plugin\rest\resource\NodeResource';
-
- $definitions['entity:node']['serialization_class'] = 'Drupal\mymodule\Entity\MyNode';
- }
-
- unset($definitions['entity:view']);
- }
- function hook_rest_type_uri_alter(&$uri, $context = []) {
- if ($context['mymodule'] == TRUE) {
- $base = \Drupal::config('hal.settings')->get('link_domain');
- $uri = str_replace($base, 'http://mymodule.domain', $uri);
- }
- }
- function hook_rest_relation_uri_alter(&$uri, $context = []) {
- if ($context['mymodule'] == TRUE) {
- $base = \Drupal::config('hal.settings')->get('link_domain');
- $uri = str_replace($base, 'http://mymodule.domain', $uri);
- }
- }
|