Add $skip_default option to \Drupal\consumers\Negotiator::negotiateFromRequest

Created on 4 April 2019, about 5 years ago
Updated 9 March 2023, over 1 year ago

Motivation

I have a situation where I need to use \Drupal\consumers\Negotiator::negotiateFromRequest to get the consumer from the request and then act on it. But, if there is no consumer data in the request do something different. Right now, \Drupal\consumers\Negotiator::negotiateFromRequest always returns consumer because it uses whatever is configured as the default if none is found in the request.

Proposed resolution

Add a (bool) $skip_default parameter to both \Drupal\consumers\Negotiator::negotiateFromRequest , and \Drupal\consumers\Negotiator::doNegotiateFromRequest so that when you're invoking the former you can optionally ask it to skip loading the default consumer and instead return NULL .

API changes

This adds a new option to the methods, but shouldn't break any existing implementations.

✨ Feature request
Status

RTBC

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States eojthebrave Minneapolis, MN

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024