2 * Implements hook_rest_resource_alter().
4 function {{ machine_name }}_rest_resource_alter(&$definitions) {
5 if (isset($definitions['entity:node'])) {
6 // We want to handle REST requests regarding nodes with our own plugin
8 $definitions['entity:node']['class'] = 'Drupal\mymodule\Plugin\rest\resource\NodeResource';
9 // Serialized nodes should be expanded to my specific node class.
10 $definitions['entity:node']['serialization_class'] = 'Drupal\mymodule\Entity\MyNode';
12 // We don't want Views to show up in the array of plugins at all.
13 unset($definitions['entity:view']);