0

I have ask in the past How to convert Content Type Title into Term reference?. Which someone suggest to used the Title Field UI in order to remove it the title and have a Term Reference field as my title field.

However, now I run into few problems where the title field is been expected like admin/page. So I was wondering if possible to set up the title field the same as the a term but automatically. I do not want the user re-type the field Title field, but at the same time I want to limit the user from choosing something that is not from the terms.

So how can I copy the taxonomy term that the user select and set up as title programmatically ?

Update 1

My content type machine name is job_per_template and taxonomy name is field_job_title_template. I have take the code from the answer below and I got this error.

Integrity check for the imported configuration failed. Error message: The data type of the configured argument does not match the parameter's <em class="placeholder">value</em> requirement..

enter image description here

  • I assume this is for Drupal 7? If so, you should be able to essentially either use the term reference as your Title field OR use a taxonomy token if you absolutely need the title field for some reason. – Webdrips Mar 13 '15 at 0:45
  • Yes, this is a D7 website. I disable the Title and I'm using the Term Reference as my title field. However, my title is been expected on other places. That's why I want to set my title base on what the user select ( in the back-end). – itsdarrylnorris Mar 13 '15 at 1:01
  • Did you see my answer? I tested it and it works. – Webdrips Mar 15 '15 at 8:12
  • I have been busy. I would test it out either tonight or tomorrow. – itsdarrylnorris Mar 16 '15 at 18:51
1

Do it with rules and the title module:

{ "rules_title_taxonomy_token" : {
    "LABEL" : "title taxonomy token",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : {
      "node_insert--package" : { "bundle" : "package" },
      "node_update--package" : { "bundle" : "package" }
    },
    "DO" : [
      { "data_set" : {
          "data" : [ "node:title-field" ],
          "value" : [ "node:field-my-taxonomy-field:0:name" ]
        }
      }
    ]
  }
}

Be sure to change "package" to the name of your content type and be sure to use the proper field name for your taxonomy instead of field-my-taxonomy-field.

As far as I know, the above only works with the Title module and the Title Field UI.

| improve this answer | |
  • Sorry for my lack of knowledge.... but what should I do with that code ? Its that Rules that needs to be import into the Rules module ? – itsdarrylnorris Mar 16 '15 at 18:53
  • Yes install the rules module, set permissions, and use the rules import feature. – Webdrips Mar 16 '15 at 21:14
  • Sound great. I would try it out. Last question before I try it out.... I would need to enable title and disable with the title module. Right ? – itsdarrylnorris Mar 16 '15 at 21:30
  • Yes you enable the title module first, and then there's a checkbox or something that says replace your title with a field. – Webdrips Mar 16 '15 at 23:22
  • @Webripds, I try it out and did not work. I have update my question so you have an understanding that error that I'm seeing it. – itsdarrylnorris Mar 17 '15 at 20:38

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.