The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
20 views

Render tokens in hook_node_view

I am creating the following pseudo field in hook_node_view: function user_guides_node_view($node, $view_mode, $langcode) { $node->content['field_mytest'] = array('#markup' => '<p>This ...
0
votes
2answers
27 views

Hook_node_view() to print a table?

I'm working on my first module. What I'd like to do is add this table http://pastebin.com/A1cbya5m function's output to the bottom of nodes. I'm not sure how to do this using hook_node_view()'s ...
0
votes
2answers
50 views

What is the best way to stop a node from loading in a node hook?

I want to use hook_node_view to stop a node from loading if it was not created by the user trying to access it. What should I include in the following code to kill the loading of the node? function ...
1
vote
1answer
107 views

Form validation after drupal_build_form in hook_node_view

In hook_node_view of one node I add a node form of a different content type as follows: global $user; $node_form = (object) array('uid' => $user->uid, 'name' => ...
1
vote
1answer
37 views

Changes made in hook_node_view() are not applied?

I wanted to change the title of a node field on the node display page. I have implemented hook_node_view() and changed the title in code using following code: $node->content['my_field']['#title'] ...
0
votes
1answer
45 views

hook to redirect user before they create node?

I'm running a db_query to check if the user has taken a specific action. If they haven't, I'm redirecting them to the page where they can take that action. function my_special_module_node_view(...) { ...
0
votes
0answers
51 views

node_view not returning body markup

I have several custom node modules and which are creating their own types. When I perform a node_load and node_view locally, all the content of the node is there. However, when moving to a ...
0
votes
1answer
204 views

How to hide a form field in hook_node_view()

function hook_node_view($node, $view_mode, $langcode) { // How can I hide a field in the hook_node_view() using $node // In my case the field is an image file field }
2
votes
1answer
31 views

Add aditional field with title to every node

I am trying to add additional field to nodes. I could add the field but I can't find a way to add its title. I have implemented the hook_node_view . My code is function cso_node_view($node, ...
0
votes
1answer
385 views

Which are the differences between hook_node_view_alter and hook_preprocess_node?

I have to remove some elements from a node before show it, but I can't understand where it's better to put the code. Mainly I can't understand the differences between hook_node_view_alter and ...
1
vote
2answers
154 views

Trouble adding markup in a node with hook_node_view()

I'm trying to add a piece of markup with a field in hook_node_view(). It's a little thumb icon for a music site, and I want to overlay this image over another field image (which I'll do with CSS). ...
1
vote
4answers
214 views

How do I hide title of a node?

I have tried doing this in hook_node_view or hook_node_view_alter with no luck: I have tried things like: unset( $node->title); or $node->title =''; note: my node was created using ...
1
vote
0answers
341 views

hook_node_view can't change content

I've read through many questions asking this same thing, but I feel like I'm doing what they are suggesting and it's still not working. I've created a custom module and enabled it. This is my code: ...
0
votes
1answer
83 views

Place a link at top AND bottom of each node

I made some code to put a button/link at the bottom of a node. But it would be nice to place this link also at the top of the node. Would this be possible? This is the code that places a button at ...
1
vote
1answer
445 views

How can I display Drupal comments on a separate page from hook_node_view()?

I have a custom implementation of hook_node_view() that changes the display of comments on every node. I would like to know how I can get the result of this improved hook_node_view() to be displayed ...