Loading src/Plugin/rest/resource/RestMenuItemsResource.php +9 −2 Original line number Diff line number Diff line Loading @@ -104,8 +104,9 @@ class RestMenuItemsResource extends ResourceBase { * * @return \Drupal\rest\ResourceResponse * The response containing a list of bundle names. * * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException */ public function get($menu_name = NULL) { if ($menu_name) { Loading @@ -130,7 +131,13 @@ class RestMenuItemsResource extends ResourceBase { // Return if the menu does not exist or has no entries. if (empty($tree)) { return new ResourceResponse($tree); $response = new ResourceResponse($tree); if ($response instanceof CacheableResponseInterface) { $response->addCacheableDependency(new RestMenuItemsCacheableDependency($menu_name, $this->minDepth, $this->maxDepth)); } return $response; } // Transform the tree using the manipulators you want. Loading Loading
src/Plugin/rest/resource/RestMenuItemsResource.php +9 −2 Original line number Diff line number Diff line Loading @@ -104,8 +104,9 @@ class RestMenuItemsResource extends ResourceBase { * * @return \Drupal\rest\ResourceResponse * The response containing a list of bundle names. * * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException */ public function get($menu_name = NULL) { if ($menu_name) { Loading @@ -130,7 +131,13 @@ class RestMenuItemsResource extends ResourceBase { // Return if the menu does not exist or has no entries. if (empty($tree)) { return new ResourceResponse($tree); $response = new ResourceResponse($tree); if ($response instanceof CacheableResponseInterface) { $response->addCacheableDependency(new RestMenuItemsCacheableDependency($menu_name, $this->minDepth, $this->maxDepth)); } return $response; } // Transform the tree using the manipulators you want. Loading