final class CartTokenSessionConfiguration in Commerce Cart API 8
Decorates SessionConfiguration to support cart tokens.
If a cart token header or query parameter is present, return that a session is active. This prevents page_cache from caching the response. This might may be removed once page_cache supports Vary headers.
@link https://www.drupal.org/project/drupal/issues/2972483
Hierarchy
- class \Drupal\commerce_cart_api\Session\CartTokenSessionConfiguration implements SessionConfigurationInterface
Expanded class hierarchy of CartTokenSessionConfiguration
1 file declares its use of CartTokenSessionConfiguration
File
- src/
Session/ CartTokenSessionConfiguration.php, line 18
Namespace
Drupal\commerce_cart_api\SessionView source
final class CartTokenSessionConfiguration implements SessionConfigurationInterface {
/**
* The decorated service.
*
* @var \Drupal\Core\Session\SessionConfigurationInterface
*/
private $decorated;
/**
* {@inheritdoc}
*/
public function __construct(SessionConfigurationInterface $decorated) {
$this->decorated = $decorated;
}
/**
* {@inheritdoc}
*/
public function hasSession(Request $request) {
return $this->decorated
->hasSession($request) || $request->headers
->has(CartTokenSession::HEADER_NAME) || $request->query
->has(CartTokenSession::QUERY_NAME);
}
/**
* {@inheritdoc}
*/
public function getOptions(Request $request) {
return $this->decorated
->getOptions($request);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CartTokenSessionConfiguration:: |
private | property | The decorated service. | |
CartTokenSessionConfiguration:: |
public | function |
Returns a list of options suitable for passing to the session storage. Overrides SessionConfigurationInterface:: |
|
CartTokenSessionConfiguration:: |
public | function |
Determines whether a session identifier is on the request. Overrides SessionConfigurationInterface:: |
|
CartTokenSessionConfiguration:: |
public | function |