0

I have a content type A with a required term reference field (vocabulary: category, widget: radios). I would like to accomplish the following:

In every term page (of this specific vobaulary) i will have an "add type A" link. When the node/add form appears (upon clicking on this link) i want the value of taxonomy term reference field to already be chosen as the category term which corresponds to the specific term page. Ideally i would like the above and also to dissapear this field from the form.

Any help?

2

There is a module for this and it's called Entity reference prepopulate.

  • I checked this module, but it does not seems to support term reference fields. Am I missing something? – Kevin Siji May 15 '15 at 18:55
-1

When you define the field for the content type, you can set a default. Then you can use the Fields Permissions module to restrict access to the field the the admin role. If the user does not possess the required role, they will not have access to the field on the edit form.

  • Hi thanks for your answer although i believe you haven't understood my requirement. It's not a matter of defining a default value nor accessing the field afterwards. My main goal is: the value of the term ref. field to automatically be chosen when adding a node, depending on the url (basically the tid) of the term page. Secondary i would like this field not to show up at all in the node form since it's already predefined. Hope i explained it thorough enough for you. – Billy Feb 27 '13 at 21:49
  • Field Permissions is the only way to hide the field from users (user 1 will always see it). If you are not working with a fixed default, you migh either use a PHP snippet to enter the default, or define a Rule to grab the required term when the node is created. – Triskelion Feb 27 '13 at 22:11

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.