Already implemented:
* label (part of ContextDefinition)
* type (part of ContextDefinition)
* description (part of ContextDefinition)
* save: autosaving implemented as autoSaveContext() on RulesActionInterface
* optional: implemented as isRequired(), part of ContextDefinition
* wrapped: obsolete in Drupal 8
* default value: D7: "(optional) The value to pass to the action, in case the parameter is optional and there is no specified value."

Open TODO:
* options list: D7: "A callback that returns an array of possible values for this parameter. The callback has to return an array as used by hook_options_list()."
* allow NULL: D7: "Usually Rules will not pass any NULL values as argument, but abort the evaluation if a NULL value is present. If set to TRUE, Rules will not abort and pass the NULL value through. Defaults to FALSE." Not sure we still need this?
* restriction: D7: "(optional) Restrict how the argument for this parameter may be provided. Supported values are 'selector' and 'input'."

Unclear / probably should work differently
* sanitize: D7: "(optional) Allows parameters of type 'text' to demand an already sanitized argument. If enabled, any user specified value won't be sanitized itself, but replacements applied by input evaluators are as well as values retrieved from selected data sources." Um, yeah, no idea what this is used for.
* bundles: entity specific, one single bundle can also be specified in the type like "entity:node:page". What should we do about multiple bundles? Do we want to support this?
* cleaning callback: (optional) A callback that input evaluators may use to clean inserted replacements; e.g. this is used by the token evaluator.

Target for a later milestone:
* ui class: optional) Allows overriding the UI class, which is used to generate the configuration UI of a parameter. Defaults to the UI class of the specified data type.
* translatable: "(optional) If set to TRUE, the provided argument value of the parameter is translatable via i18n String translation. This is applicable for textual parameters only, i.e. parameters of type 'text', 'token', 'list' and 'list'. Defaults to FALSE."

Comments

dasjo’s picture

Priority: Critical » Normal
klausi’s picture

Status: Active » Needs review

Implemented a first step at https://github.com/fago/rules/pull/64

This introduces the RulesState from D7 and has a first integration test for passing alonog context values during Rules execution.

klausi’s picture

Now started to work on the data selector part, see https://github.com/fago/rules/pull/71

  • klausi committed a8d8f76 on 8.x-3.x
    Issue #2245039 : Implemented data selector application in RulesState.
    

  • klausi committed 1debd47 on 8.x-3.x
    Issue #2245039 by klausi: Implemented exception handling for required...
klausi’s picture

Next step is to add auto saving capabilities to context parameters.

Unfortunately we cannot extend the ContextDefinition annotation, so I invented a autoSaveContext() method on the Rules action interface which specifies the context parameters that should be auto saved.

Started to work on a test case, implementation will follow: https://github.com/fago/rules/pull/91

klausi’s picture

The auto-saving approach is now merged into 8.x-3.x. Improvements/suggestions welcome!

klausi’s picture

Issue summary: View changes
fago’s picture

Status: Needs review » Needs work
fago’s picture

Issue summary: View changes

Updated overview.

fago’s picture

Issue summary: View changes
fago’s picture

Important first step to resolve the remaining issues addressed via https://github.com/fago/rules/pull/219. I'll take care of the options stuff + adding all options provider integration to Rules, klausi said to take a look at allow-null and restriction.

klausi’s picture

Version: 8.x-1.x-dev » 8.x-3.x-dev
Status: Needs work » Needs review

Started with the "allow_null" option: https://github.com/fago/rules/pull/222

fago’s picture

Status: Needs review » Needs work

thanks, added a few remarks there.

klausi’s picture

Status: Needs work » Needs review

Fixed your remarks, please review again!

fago’s picture

fago’s picture

thanks for the updates, merged!

klausi’s picture

Status: Needs review » Active

no commit credit, boohoohoo ...

  • fago committed aa29d8d on 8.x-3.x
    Issue #2245039 by klausi: Implemented allow NULL values on context...
klausi’s picture

Status: Active » Needs review

And the first version of parameter restriction is ready for review: https://github.com/fago/rules/pull/223

fago’s picture

Status: Needs review » Needs work

thanks, looks mostly good. added a few remarks though, I think we should rename the option as we do not use the parameter wording anywhere else in d8. see PR

klausi’s picture

Status: Needs work » Needs review

ready for review again.

  • klausi committed bd789e3 on 8.x-3.x
    Issue #2245039: Implemented context assignment restrictions
    
klausi’s picture

Status: Needs review » Active

Merged that pull request. Anything left here to do?

fago’s picture

Issue tags: +beta blocker

yes, support for parameter options.

fago’s picture

Status: Active » Fixed

ok, there is #2700541: Add support for context options. Also created some sub-tasks for stuff not clarified yet. Thus, I think we can close this.

Status: Fixed » Closed (fixed)

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