0

I have a a custom module in which I am implementing hook_node_presave() for a content type "ABC".

I want to get the value of a text field say 'field_test' before saving the node.

How to do this.

| improve this question | | | | |
1

Use the following code,

$value = $node->field_test[$node->language][0]['value']

This to get the value for the text field alone for other fields format will chage.

| improve this answer | | | | |
  • How to get the values for a node reference field – Cindrella Oct 18 '12 at 5:31
  • Asking a Question in comments are not accepted in the Stack Exchange ! Please create a new Question with details if needed. – Anil Sagar Oct 18 '12 at 5:38
  • @Anil Sagar: hmm ok. anyways got the answer for the question. No need to create a new question. – Cindrella Oct 18 '12 at 5: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.