Right now, core condition implementations miss the metadata that's required for Rules to be able to make use of the conditions also. Rules requires metadata about the configuration values what right now should live in the condition plugin definition below the 'configuration' key:
From ExecutableInterface

 * - configuration: An array of configuration option definitions, keyed by
 *   option name. Each option definition is a typed data definition describing
 *   the configuration option. Check the typed data definition docs for details.

Let's make sure that's implemented in all core conditions such that Rules can build upon them.

Related issue: #1920816: Factor getConfig(), setConfig(), getConfigDefinition(), and getConfigDefinitions() out of ExecutablePluginBase

Next steps

See if patch can be rerolled for current d8 head. https://drupal.org/contributor-tasks/reroll

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fago’s picture

Status: Active » Needs review
FileSize
5.04 KB

I forgot to explain why the initial conditions patch went in without providing metadata: At this point we had no general TypedData list class, so providing metadata for the NodeType configuration let it fail validation. Meanwhile we've that general TypedData list class, so there is no reason to not add the metadata any more.

ok, here is a patch which adds in the missing metadata for all conditions existing right now. Unfortunately,
the language condition was relying on a FAPI data structure as returned from the FAPI array, for which it would be (unnecessary) hard to provide the metadata. Let's better don't design around FAPI structures, but make FAPI follow our API. Patch attached.

benjifisher’s picture

#1: d8_conditions_metadata.patch queued for re-testing.

dcam’s picture

http://drupal.org/node/1427826 contains instructions for updating the issue summary with the summary template.

Status: Needs review » Needs work

The last submitted patch, d8_conditions_metadata.patch, failed testing.

claar’s picture

Status: Needs work » Needs review
FileSize
4.98 KB

Rerolled to cleanly apply against latest 8.x

The last submitted patch, d8_conditions_metadata_2.patch, failed testing.

fago’s picture

Status: Needs work » Needs review

#5: d8_conditions_metadata_2.patch queued for re-testing.

Berdir’s picture

#5: d8_conditions_metadata_2.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, d8_conditions_metadata_2.patch, failed testing.

Anonymous’s picture

Issue summary: View changes

improved language

YesCT’s picture

Issue summary: View changes
Issue tags: +Needs reroll
Sam Hermans’s picture

Assigned: Unassigned » Sam Hermans

I'll check this out

Sam Hermans’s picture

Assigned: Sam Hermans » Unassigned
Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
4.42 KB

Re-rolled to current d8 head .. the patch changes the Language plugin array from key value to list and updates the test.

Tested locally and fails with the following message:

Argument 1 passed to Drupal\Core\TypedData\TypedDataManager::create() must be an instance of Drupal\Core\TypedData\DataDefinitionInterface, array given, called in /core/lib/Drupal/Core/Executable/ExecutablePluginBase.php on line 98 and defined

Setting status to 'needs review' so we can get the results from the bot.

Status: Needs review » Needs work

The last submitted patch, 12: d8_conditions_metadata_12.patch, failed testing.

fago’s picture

Issue tags: +Rules 8.x
tim.plunkett’s picture

+++ b/core/modules/node/lib/Drupal/node/Plugin/Condition/NodeType.php
@@ -22,6 +22,12 @@
+ *   configuration = {
+ *     "bundles" = {
+ *       "type" = "string",
+ *       "list" = true
+ *     }

Do we have any way to go from this to something like

  mapping:
    bundles:
      type: sequence
      sequence:
        - type: string

For config schema?

Also we need to do this (or something like it) for all of configurable plugins.

fago’s picture

Not right now, but true - config schema is really related and we could come up with code to generate it from the annotation. But the config schema has to be written to a file, right? :/

tim.plunkett’s picture

Title: Condition plugins miss metadata about configuration » Plugins miss metadata about configuration
Component: language.module » plugin system
Issue tags: +Plugin system
fago’s picture

Issue tags: -Plugin system +d8rules
fago’s picture

Issue tags: +Plugin system
yched’s picture

The problem is that localize.d.o forbids an approach where you have to execute code in order to generate config schemas. See @gabor for more details.

fago’s picture

So for #d8rules we currently do not separate between context and configuration (which is just context which has by default a form input), but use context for everything. We considered going with two keys for defining context + configuration, but it turned out this just makes things unnecessarily more complex when it's required to determine a ordering across all parameters (context+configuration).

Still an open question is how exactly we'll handle the UI challenges of generating a form that has context mapping and makes use of the provided configuration form (or not).

Xano’s picture

Is this in any way related to the configuration plugins get through the factory or ConfigurablePluginInterface?

Xano’s picture

Bump?

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)

The code in question seems to have changes from 8 years ago

Can anyone confirm if they are still having this issue?

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Since there hasn't been a follow up in almost a year going to close out for now

If still a bug please reopen

Thanks everyone!