I am declaring a condition in which I have the following parameters:

            'node_type' => array(
            'type' => 'text',
            'label' => t('the node type'),
            'options list' =>/*'entitystep_get_list_node_types'*/ 'node_type_get_names' ,
            'restriction' => 'input',
        'node_field' => array(
            'type' => 'text', //TODO: find or create node_field datatype? *node_element?
            'label' => t('the node its field to be checked'),
            'options list' => 'entitystep_get_fields' 

// TODO: check how to pass a parameter to the entitystep_get_fields!!! ($node_type) ),

In the 'entitystep_get_fields (on the bottom) I have to pass the selected node_type (=the first parameter)

These are the functions I need to call:

function entitystep_get_list_node_types() {
    $types = db_query("SELECT n.type FROM node_type");
    return types;

function entitystep_get_nodes_by_type($node_type) { $nodes = db_query("SELECT * FROM node WHERE type=" . $node_type ); return $nodes; }

  • There are API functions that return node types (api.drupal.org/api/drupal/modules%21node%21node.module/function/…) loading nodes (node_load_multiple(), EntityFieldQuery). No need to add your own, insecure functions.
    – Berdir
    Commented Apr 17, 2012 at 8:26
  • Apart from that, I am not sure what you are trying to accomplish or why the default node type condition does not work for you. Maybe start with explaining what you actually want to achieve, it might be mucher simpler than you think.
    – Berdir
    Commented Apr 17, 2012 at 8:28
  • ahaa, well that could indeed come in handy! To read the 'big idea', check this question: drupal.stackexchange.com/questions/27941/… when, in a multistep-form, continue is pressed I want to prepopulate certain fields in the next step getting data from a node keyed by user-entered data from a field in the current step.
    – Kj.
    Commented Apr 17, 2012 at 8:40
  • 1
    I still really need this.. for other problems as well..
    – Kj.
    Commented Apr 24, 2012 at 12:25

1 Answer 1


Have a look to the entity condition "entity_is_of_bundle"

In this example there are three parameters and they are displayed through a multistep form. To do this, you will need to alter the form. In this example, it is rules_condition_entity_is_of_bundle_form_alter

You can notice that depending on the form state, some elements are hidden. When you go to the next step, you can access form values. In this example, we can access entity bundles of the entity type as do the function rules_entity_bundle_options. The type of the entity is within $element->settings['type']

I hope it is clear for you.

Your Answer

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

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