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.

0

1 Answer 1

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.

3
  • How to get the values for a node reference field
    – Cindrella
    Oct 18, 2012 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, 2012 at 5:38
  • @Anil Sagar: hmm ok. anyways got the answer for the question. No need to create a new question.
    – Cindrella
    Oct 18, 2012 at 5:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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