I have a node type with a number of term reference fields (i.e. size, color, shape) that I would like to use to create the title of the node.

So, for example, if I choose 1 foot, blue and round as my terms, I would like the node title to save as "1 foot blue round."

Is it possible to create the rule in such a way to set the title on the CURRENT node? How might I go about accomplishing it if it is possible? (I have had success using rules to set the title of a NEW node, but not the one I'm currently trying to save.)

Comments

saurabh.dhariwal’s picture

Issue summary: View changes

Please follow the below steps to resolve your issue:

Step 1 : Enable PHP Filter module

Step 2 : Create rule action with Execute custom php code

Retrieve your taxonomy.

 $field = $node->field_my_vocabulary;
                        $terms_en = $field['en'];
                        foreach ($terms_en as $term) {
                                $terms .= 'Your taxonomy name';
                        }

Update your node title with taxonomy term name.

 $node->title = $node->title . $terms;
                         node_save($node);

Let me know if any query/concern regarding this.

Thanks!

TR’s picture

Status: Active » Fixed

#1 provides a solution.

Status: Fixed » Closed (fixed)

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