1

So what are the steps for the Rules module to copy taxonomy terms of a node into a textfield?

How do you copy all the taxonomy terms of a node and populate a text field with them?

Note: I am testing search speed of views exposed filters. Instead of using relatioships I will create a field containing keywords of all other fields in a form of an "index" and I will search on that.

  • Is there any specific reason on why you are saving terms in a textfield? – NTT Oct 27 '16 at 11:49
  • I am testing search speed of views exposed filters. Instead of using relatioships I will create a field containing keywords of all other fields in a form of an "index" and I will search on that. – pierostz Oct 27 '16 at 12:10
  • @Pierre.Vriens rephrased and answered. Thanks for you suggestions. – pierostz Oct 28 '16 at 14:11
0

Well that was easy then.

Create a rule with this configuration.

  1. Trigger the rule "After updating existing content" and "After saving new content".

  2. IMPORTANT. Create a condition with "Entity is of bundle" and choose the desired Content Type. If you don't do this, not all the fields of the content type are exposed to rules for manipulation.

  3. The Action is "Set Data Value" and as Data choose you text field (node:field-keywords in my case). For value choose your desired terms field ([node:field-business-categories] in my case).

Run a "Published" procedure on all desired nodes with VBO and you are done.

And here is the exported rule.

{ "rules_keyword_field_generation" : {
"LABEL" : "Keyword Field Generation",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_update" : [], "node_insert" : [] },
"IF" : [
  { "entity_is_of_bundle" : {
      "entity" : [ "node" ],
      "type" : "node",
      "bundle" : { "value" : { "business" : "business" } }
    }
  }
],
"DO" : [
  { "data_set" : {
      "data" : [ "node:field-keywords" ],
      "value" : "[node:field-business-categories]"
    }
  }
]

} }

  • I trust this solution works for you. But I think you should improve (extend) that phrase containing VBO a bit: (a) what is a published procedure? and (b) what are the specs of that VBO? Also, your question is about "a" node (that sounds like 1 to me), so why does VBO have to get involved in this? Maybe you should adapt your own question with something like "for all nodes of a selected content type" (in that case VBO perfeclty makes sense of course). – Pierre.Vriens Oct 28 '16 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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