My main question regarding Drupal 8 is, 'How to best theme the WSOD'?

Comments

tuccio created an issue. See original summary.

Torenware’s picture

Rules 8.x-3.0 unstable5 is, well, unstable. It's also almost 2 months behind 8.x-3.x-dev.

We should probably take down unstable5, since Core made some significant changes that broke Rules just before 8.0-rc1. So I'm not surprised that unstable5 white-screens.

In general, I recommend folks that are trying out Rules for D8 use our dev version. We use automated tests, so in general, dev will work well against Drupal 8.0rc2 or later. Be aware, however, that the UI for Rules is not in yet. So if you are doing things with Rules, you need to be able to create reaction rules in Code. This is not for most people :-)

What are you trying to do right now with Rules?

tuccio’s picture

Thank you for your reply. I have now downloaded the 8.x-3.x-dev version and I could enable it without problems. I see a UI at admin/config/workflow/rules and it apparently only allows creating a name for a reaction rule or rule component but nothing else.

So I guess I'll look for some documentation on how to create rules in code in Drupal 8. Given my coding skills, I am really going to learn how to style WSODs now.

I was hoping to have Rules working in D8 because most contributed modules still have to catch up but with Rules many features can often be added thanks to its flexibility without having to resort to specialized contributed modules. I was planning to build a simple issue tracker in D8 and I thought that perhaps I could use Rules to update the ticket status when submitting a comment (sort of what Comment Alter does in D7).

Torenware’s picture

So I guess I'll look for some documentation on how to create rules in code in Drupal 8. Given my coding skills, I am really going to learn how to style WSODs now.

There isn't too much, although this comment gives the flavor of it. There's also code in the Rules test/src directory, although it can be a bit confusing: we use a lot of test mocking, which is weird looking code and not relevant to what you want to do.

I'm probably going to blog on this soon, since I think this stuff is stable enough to use, but hard to pull off if you don't have good sample code.

tuccio’s picture

Thank you very much. I am looking forward to your blog post and any additional documentation.

klausi’s picture

Category: Bug report » Support request
Status: Active » Fixed

Yes, please try again with the most recent dev version.

Daniel Schaefer’s picture

With the lastest dev version, my site crashes to 500 Internal Server error once I add a condition.

What I'm trying to do:
Redirect users of a specific role to a specific page

What I've done:

  • Created rule on "Drupal initializing"
  • Added condition: User role (from the beginning of the list), entered the role in the next input field
  • Added action: Show message on the site (just for testing)

What has happend:

  • Nothing, so I rebuild cache using Drush
  • 500 Error.

Apache log:

PHP Fatal error:  Call to undefined method Drupal\\user\\Plugin\\Condition\\UserRole::refineContextDefinitions() in .../modules/rules/src/Plugin/RulesExpression/RulesCondition.php on line 114

So I uncommented that line:
No more WSOD but "The website encountered an unexpected error. Please try again later." and in the logs:

 Recoverable fatal error: Argument 1 passed to Drupal\\rules\\Plugin\\RulesExpression\\RulesCondition::mapProvidedContext() must be an instance of Drupal\\rules\\Context\\ContextProviderInterface, instance of Drupal\\user\\Plugin\\Condition\\UserRole given, called in .../modules/rules/src/Plugin/RulesExpression/RulesCondition.php on line 124 and defined in .../modules/rules/src/Context/ContextHandlerTrait.php on line 87

Only way to recover is to uninstall Rules and rebuild cache. I tried with the lastest dev-Version as well as unstable5 and unstable6, same thing. Also tried the "user has role" condition but I had no clue what to enter. I copied the values from Drupal 7 but had no effect.

Daniel Schaefer’s picture

Status: Fixed » Needs work
klausi’s picture

Version: 8.x-3.0-unstable5 » 8.x-3.x-dev
Status: Needs work » Fixed

Ah yes, the first 4 conditions you see in the UI when selecting a conditions are from core - they don't support all of our APIs and we still need to decide what to do about them. Filed #2648276: Fatal errors when core conditions are used.

Yes, currently you need to clear caches before a rule will ever fire. Filed #2648284: Service container rebuild is required when events are configured for that.

The UserHasRole condition in rules is not quite ready yet in the UI because we are missing support for multiple contexts (multiple roles in this case). Filed #2648300: Support multiple contexts in the UI.

Thanks for reporting!

Status: Fixed » Closed (fixed)

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