While the Rules 8.x conditions API is not fully finished yet, we can already port conditions to the existing core API. We are working at https://github.com/fago/rules - where you can some help on how to contribute!
Conditions overview
Data (data.rules.inc)
- Data comparison (data_is) #2281079: Port "Data comparison (data_is)" condition to 8.x Assigned to diarmys
- Data value is empty (data_is_empty) #2281081: Port "Data value is empty (data_is_empty)" condition to 8.x
- List contains item (list_contains) #2281083: Port "List contains item (list_contains)" condition to 8.x
- List count comparison (list_count_is) #2281085: Port "List count comparison (list_count_is)" condition to 8.x
- Text comparison (text_matches) #2281087: Port "Text comparison (text_matches)" condition to 8.x Assigned to: tr
Entities (entity.rules.inc)
- Entity is new (entity_is_new) #2281089: Port "Entity is new (entity_is_new)" condition to 8.x
- Entity has field (entity_has_field) #2281107: Port "Entity has field (entity_has_field)" condition to 8.x Assigned to: lokapujya
- Entity is of type (entity_is_of_type) #2281109: Port "Entity is of type (entity_is_of_type)" condition to 8.x Assigned to: ndewhurst
- Entity is of bundle (entity_is_of_bundle) #2281111: Port "Entity is of bundle (entity_is_of_bundle)" condition to 8.x
- User has field access (entity_field_access) #2281113: Port "User has field access (entity_field_access)" condition to 8.x Assigned to: Torenware
Node (node.rules.inc)
- Content is of type (node_is_of_type) #2281117: Port "Content is of type (node_is_of_type)" condition to 8.x Assigned to: BigEngland
- Content is promoted to frontpage (node_is_promoted) #2269565: Port "Content is promoted" condition to 8.x
- Content is published (node_is_published) #2269569: Port the "Content is published" condition to 8.x Assigned to: paranojik
- Content is sticky (node_is_sticky) #2269571: Port "Content is sticky" condition to 8.x Assigned to: jzavrl
Path (path.rules.inc)
- Path has URL alias (path_has_alias) #2269575: Implement "Path has url alias" condition
- URL alias exists (path_alias_exists) #2269573: Port "Path alias exists" condition to 8.x Assigned to: bbujisic
User (user.rules.inc)
- User has role(s) (user_has_role) #2281119: Port "User has role(s) (user_has_role)" condition to 8.x
- User is blocked (user_is_blocked) #2269585: Port condition "User is blocked" to 8.x Assigned to: fago
PHP - Execute custom PHP code (php_eval) (is gone in Drupal 8: #1203886: Remove the PHP module from Drupal core)
To get started
- pick your condition from above, create an issue for it and edit the list to reference the issue
- look at the
Drupal\node\Plugin\Condition\NodeTypeclass (a core conditin) andDrupal\condition\Tests\Condition\NodeConditionTest. - Compared to the core NodeType condition, we do not use configuration or configuration forms yet, but specify all parameters as context for now. (The form stuff is still to be figured out)
Comments
Comment #1
omissis commentedComment #2
omissis commentedComment #3
paranojik commentedComment #4
fagoComment #5
bircherComment #6
jzavrl commentedComment #7
nebel54Comment #8
bircherComment #9
fagoComment #10
dasjoComment #11
dasjoComment #12
dasjoComment #13
dasjohere's a list of current d7 rules conditions
Data
Data comparison (data_is)
Data value is empty (data_is_empty)
List contains item (list_contains)
List count comparison (list_count_is)
Text comparison (text_matches)
Entities
Entity is new (entity_is_new)
Entity has field (entity_has_field)
Entity is of type (entity_is_of_type)
Entity is of bundle (entity_is_of_bundle)
User has field access (entity_field_access)
Node
Content is of type (node_is_of_type)
Content is promoted to frontpage (node_is_promoted)
Content is published (node_is_published)
Content is sticky (node_is_sticky)
Path
Path has URL alias (path_has_alias)
URL alias exists (path_alias_exists)
User
User has role(s) (user_has_role)
User is blocked (user_is_blocked)
PHP (evil)
Execute custom PHP code (php_eval)
Comment #14
dasjoupdated to add a complete conditions overview
Comment #15
dasjoComment #16
fagoComment #17
diarmy commentedComment #18
Torenware commentedI made sure that ibonelli is marked as working on #2281089.
Comment #19
dasjoComment #20
dasjoComment #21
dasjoas its a meta issue without a patch, setting to active instead of needs work
Comment #22
fagoI re-opened a few issues where there is some follow-up work todo.
Comment #23
simeI'm noticing that in d8 all the rules conditions appear to be broken in the block configuration - was this due to a change in core since they were done? or was the block configuration integration a pending task?
Comment #24
fagoad sime: thx, I've opened for #2675698: Ensure compatibility with core block UI (part of #2675682: [META] Condition compatibility with Core/CTools conditions) for handling this!
Comment #25
tr commentedBump. Looking for people to address the few remaining issues here.
Comment #26
tr commentedAll conditions have now been ported to D8, so this meta has been completed. Problems with and/or enhancements of these conditions should be handled in follow-up issues.