Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / rest_resource_alter.twig
1 /**
2  * Implements hook_rest_resource_alter().
3  */
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
7     // class.
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';
11   }
12   // We don't want Views to show up in the array of plugins at all.
13   unset($definitions['entity:view']);
14 }