public function CartTokenSessionConfiguration::hasSession in Commerce Cart API 8
Determines whether a session identifier is on the request.
This method detects whether a session was started during one of the previous requests from the same user agent. Session identifiers are normally passed along using cookies and hence a typical implementation checks whether the session cookie is on the request.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request.
Return value
bool TRUE if there is a session identifier on the request.
Overrides SessionConfigurationInterface::hasSession
File
- src/
Session/ CartTokenSessionConfiguration.php, line 37
Class
- CartTokenSessionConfiguration
- Decorates SessionConfiguration to support cart tokens.
Namespace
Drupal\commerce_cart_api\SessionCode
public function hasSession(Request $request) {
return $this->decorated
->hasSession($request) || $request->headers
->has(CartTokenSession::HEADER_NAME) || $request->query
->has(CartTokenSession::QUERY_NAME);
}