You are here

protected function PanelsBreadcrumbBuilder::getRequestForPath in Panels Breadcrumbs 8

Get request object from path.

1 call to PanelsBreadcrumbBuilder::getRequestForPath()
PanelsBreadcrumbBuilder::build in src/Breadcrumb/PanelsBreadcrumbBuilder.php
Builds the breadcrumb.

File

src/Breadcrumb/PanelsBreadcrumbBuilder.php, line 145

Class

PanelsBreadcrumbBuilder
Class PanelsBreadcrumbBuilder.

Namespace

Drupal\panels_breadcrumbs\Breadcrumb

Code

protected function getRequestForPath($path) {
  $request = Request::create($path);

  // Performance optimization: set a short accept header to reduce overhead in
  // AcceptHeaderMatcher when matching the request.
  $request->headers
    ->set('Accept', 'text/html');

  // Attempt to match this path to provide a fully built request.
  $request->attributes
    ->add($this->router
    ->matchRequest($request));
  return $request;
}