0

I'm using the "Entity is of type" condition for the After updating content event, the rule only fire when the field has a value of that updated/created node. The field, which is part of a custom content type.

When I select Entity is of type and try to add Entity(Specifies the entity for which to evaluate the condition.) value like [node] and Type(The entity type specified by the condition.) of value like [node:field_alias_1:value]

I got the following error.

TypeError: Argument 1 passed to Drupal\rules\Plugin\Condition\EntityHasField::doEvaluate() must implement interface Drupal\Core\Entity\FieldableEntityInterface

If the field has the value of that content type, how do I create a new redirect alias using that field name?

2 Answers 2

2

To my knowledge the current answer to this question is: you can't do that yet with the most recent D8 version of Rules. Refer to #d8rules status update November 2017 to get a better understanding of the current status of Rules for D8. Here is a quote from it:

... Fago can’t dedicate time required to develop the module further. What Rules is really missing at the moment is development capacity to help finish the last milestone.

One never realizes what has been done, only what remains to be done ... So start here if you wonder how to contribute.

4
  • 1
    I am shocked to see they are having a hard time raising the rest of the money. Do companies not realize how much development time Rules can save them?
    – No Sssweat
    Dec 22, 2017 at 3:35
  • Thanks for your reply. So, apart from Rules Module, How should I fulfilled this requirement, I mean which approach should I take? Any custom approach? Thanks.
    – latikas
    Dec 22, 2017 at 4:55
  • 1
    @NoSssweat Welcome to the club of shocked Rules fans (= I 200% agree)! I just don't get it how any (repeat any) serious D8 site can be in production without a stable Rules module. Must be that those production ready D8 sites have payed huge amounts to create (and maintain?!?!) tons of custom code (instead of using that money to contribute to D8Rules). Or they suffer "modulitis" similar to my "plan-b" in this answer. PS: hang on for more answers similar to this one here ... Dec 22, 2017 at 9:48
  • @latikas Good (new) question, I have no answer. Except "maybe you want to sponsor the rest of the money?" (as in the first comment) instead of wasting it to custom code that will be obsolete when Rules for D8 becomes available? Dec 22, 2017 at 9:51
0

The "Entity is of type" condition DOES work in Rules for Drupal 8, and has worked for many years.

The reason for the error cited by the original poster is that the D7 token syntax "[node:field_alias_1:value]" is not used in D8. You must use a token like "{{ node.field_alias_1.value }}" in the direct input mode. Likewise, to specify the entity, instead of "[node]" simply use "node" in the data selector.

This documentation may help: https://www.drupal.org/docs/8/modules/d8-rules-essentials/token-replacement

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.