Score:0

Any Context PHP Condition Plugin going forward

au flag

The context module relies on the now deprecated php filter module for the PHP conditions. Basically, if you want to write a context with condition based on PHP, you must install php filter.

Since php filter is now deprecated, is there any module replacing that?

Score:3
cn flag

I think the replacement is not another contrib module but extending the Context module itself with your own PHP code in a custom module.

The PHP Filter was removed from Drupal core to make it harder to make careless PHP mistakes that cause security issues with sites. This won't be replaced with another module because it's a bad idea.

So if you need to add custom PHP code, it should be written in your own custom module (extending the classes/plugins provided by Context).

Score:2
cn flag

The deprecated module you are mentioning simply implements a core condition plugin. You can use this as example and put your own PHP in the evaluate() method: https://git.drupalcode.org/project/php/-/blob/8.x-1.x/src/Plugin/Condition/Php.php

Or add the condition plugin to a custom module with Drush

drush generate plugin-condition

and you get a self-explanatory example working out-of-the-box.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.