1

I'd like to add a date field ("date") and a text field ("notes") to a taxonomy term ("Category"). Easy enough.

When I add content, I have the taxonomy term linked using term reference, and it is working fine.

What I can't figure out is this: I'd like the "date" and "notes" field to also appear on the add content screen once the "Category" is selected, and be fully editable. How would I go about this?

Specifically, when I add content, I select the category and enter all other relevant data. I then enter a date and notes that apply to that node being created, and also apply to any other node of the same category.

Thank you for help!

0

Am not familiar with any contributed module which will server your requirement. But i can help you to achieve this functionality.

Add the Date and Notes field to the specific content type using the 'Add Existing field' option. Since you have already created the fields for taxonomy term, its not necessary to create a new fields.

While adding a new content of that particular content type, mention the category , date and notes in the respective fields.

Now what we need to do is to hack-into the node submit flow and update the specific taxonomy term with the newly entered date and notes values.

Easily do this by using a single hook : hook_node_presave($node)

You can using this hook in any of the custom module. The '$node' variable will contain the date and notes values. We can easily load the selected taxonomy and update the date and notes of the taxonomy via DB queries

Thanks, Vineeth

| improve this answer | |
  • Vineeth, thanks for the quick help. I've been poking around but am unable to follow your directions. Sorry I'm a bit of a noob in code hacking! I'm guessing I need to add this to node.pages.inc, but not sure how/where? Would you be able to tell me a bit more? Thanks again, and sorry for the additional request!! – TitoNYC Jul 9 '14 at 18:24
0

we should create a custom module. Please follow these steps:


Step 1: Create a folder named 'mytweeks' inside '/sites/all/modules' folder


Step 2: Create 2 files [mytweeks.info and mytweeks.module] inside the 'mytweeks' folder


Step 3: Add the following lines inside mytweeks.info file and save it:

name = My Tweeks
description = "This module is to tweek my node actions"
core = 7.x

Step 4: Add the following lines inside mytweeks.module file and save it.

function mytweeks_node_presave($node){

/*
The $node variable will contain all the submitted node form values.
Extract the 'date' and 'notes' values from $node variable. 
Below this comment, write your PHP-MYSQL logic to update those values to the respective taxonomy term field. 
This function will be invoke whenever you submit a content/node add form.
*/

}

Hope this helped.

Thanks

| improve this answer | |
  • Thank you Vineeth for the additional info, I'll follow your your directions above and see if I can get it to work! – TitoNYC Jul 17 '14 at 3:55

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.