You are here

private function RestMenuItemsResource::setup in Rest menu items 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/rest/resource/RestMenuItemsResource.php \Drupal\rest_menu_items\Plugin\rest\resource\RestMenuItemsResource::setup()
  2. 8 src/Plugin/rest/resource/RestMenuItemsResource.php \Drupal\rest_menu_items\Plugin\rest\resource\RestMenuItemsResource::setup()

This function is used to generate some variables we need to use.

These variables are available in the url.

1 call to RestMenuItemsResource::setup()
RestMenuItemsResource::get in src/Plugin/rest/resource/RestMenuItemsResource.php
Responds to GET requests.

File

src/Plugin/rest/resource/RestMenuItemsResource.php, line 216

Class

RestMenuItemsResource
Provides a resource to get bundles by entity.

Namespace

Drupal\rest_menu_items\Plugin\rest\resource

Code

private function setup() {

  // Get the current request.
  $request = \Drupal::request();

  // Get and set the max depth if available.
  $max = $request
    ->get('max_depth');
  if (!empty($max)) {
    $this->maxDepth = $max;
  }

  // Get and set the min depth if available.
  $min = $request
    ->get('min_depth');
  if (!empty($min)) {
    $this->minDepth = $min;
  }
}