In d7 parameters can be defined using the following keys:

 *   - restriction: (optional) Restrict how the argument for this parameter may
 *     be provided. Supported values are 'selector' and 'input'.
 *   - default mode: (optional) Customize the default mode for providing the
 *     argument value for a parameter. Supported values are 'selector' and
 *     'input'. The default depends on the required data type.

We need the same functionality for d8. Although we cannot leverage this in the very near future, imo we should define that soon so people can already specify it when writing actions.

Comments

Torenware’s picture

Fago --

Could you elaborate a bit on this?

I'm starting to work in areas of the code that process context, and it's not clear what "pre-configured" or "mapped only" mean.

A \Drupal\rules\Context\ContextConfig object contains a protected $config member that contains

  /**
   * The config array.
   *
   * @var array
   */
  protected $config = [
    'context_values' => [],
    'context_mapping' => [],
    'context_processors' => [],
    'provides_mapping' => [],
  ];

It's not clear what these do, or how they need to map to what APIs are used to manipulate contexts for actions or conditions. The tests don't really cover this yet.

fago’s picture

Status: Active » Fixed

this issue is actually fixed, see ContextDefinitionInterface that's part of Rules.

@question: Look at the respective methods of the ContextConfig object, they describe what the keys are up for. They keys really are just the internal storage format and shouldn't be of interested for you - you can and should always use the ContextConfig class outside of RulesExpression classes.

If that's not clear, I'm happy to explain the concepts in person also.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.