Rules Conditions - How to make entity fields available programmatically?

by Leiph   Last Updated January 10, 2018 13:07 PM

I need to use the core condition 'Entity has field' but without the selection list restriction. With hook_rules_condition_info_alter I am able to input field names as variables.

The code in 'rules_condition_entity_has_field' requires 'field_name' to be an array, not a string. The function function field_info_field will do the preprocess job, after checking whether the input is a string or array.

But here I am stuck. I can't grab the input. For instance - a simple

if(is_string($field_name)) ...

crashes the site. $field_name is unknown within this (MYMODULE) module.

How to do this?

Related Questions

How can I get value in entity reference with Rules

Updated September 06, 2017 04:07 AM

Date field comparison in Rules

Updated March 23, 2017 10:07 AM

How to use cck time field in rules?

Updated March 23, 2017 14:07 PM